Prechádzať zdrojové kódy

PC端商品分类修改

zjy 3 mesiacov pred
rodič
commit
b26bfaa6eb

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

@@ -66,5 +66,5 @@ public class SecondGoodsCategory implements Serializable {
     private Integer updatedUserId;
 
     @TableField(exist = false)
-    private List<SecondGoodsCategory> children = new ArrayList<>();
+    private List<SecondGoodsCategory> children = null;
 }

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

@@ -0,0 +1,35 @@
+package shop.alien.entity.second.vo;
+
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 二手商品类别表
+ */
+@Data
+@JsonInclude
+@ApiModel(value = "SecondUserViolation对象", description = "二手交易平台管理举报")
+public class SecondUserViolationDetailVo extends SecondUserViolationVo{
+    private static final long serialVersionUID = 1L;
+
+    @ApiModelProperty(value = "举报内容")
+    private String otherReasonContent;
+
+    @ApiModelProperty(value = "举报图片")
+    private String reportEvidenceImg;
+
+    @ApiModelProperty(value = "举报图片集合")
+    private List<Map<String, Object>> imgList;
+
+    // 商品信息
+    private SecondGoodsVo secondGoods;
+
+
+
+}

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

@@ -1,31 +1,74 @@
 package shop.alien.entity.second.vo;
 
+
+import com.fasterxml.jackson.annotation.JsonInclude;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import shop.alien.entity.store.LifeUserViolation;
+import lombok.NoArgsConstructor;
 
-import java.util.List;
+import java.io.Serializable;
+import java.util.Date;
 
 /**
- * <p>
- * 用户举报
- * </p>
- *
- * @author ssk
- * @since 2025-04-29
+ * 二手商品类别表
  */
 @Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value="LifeUserViolation对象", description="用户举报")
-public class SecondUserViolationVo extends LifeUserViolation {
-
+@JsonInclude
+@NoArgsConstructor
+@ApiModel(value = "SecondUserViolation对象", description = "二手交易平台管理举报")
+public class SecondUserViolationVo implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty(value = "商品图片")
-    private List<String> imgUrl;
+    @ApiModelProperty(value = "分页页数")
+    private Integer pageNum;
+
+    @ApiModelProperty(value = "分页条数")
+    private Integer pageSize;
+
+    @ApiModelProperty(value = "主键ID")
+    private Integer id;
+
+    @ApiModelProperty(value = "被举报用户名称")
+    private String reportedUserName;
+
+    @ApiModelProperty(value = "被举报用户电话")
+    private String reportedUserPhone;
+
+    @ApiModelProperty(value = "举报用户名称")
+    private String reportingUserName;
+
+    @ApiModelProperty(value = "举报用户电话")
+    private String reportingUserPhone;
+
+    @ApiModelProperty(value = "举报类型")
+    private String reportContext;
+
+    @ApiModelProperty(value = "举报类型 4:二手商品 5:二手用户")
+    private Integer reportContextType;
+
+    @ApiModelProperty(value = "举报枚举")
+    private String dictDetail;
+
+    @ApiModelProperty(value = "举报状态")
+    private String processingContext;
+
+    @ApiModelProperty(value = "举报状态 0:待处理 1:已通过 2:已驳回")
+    private String processingStatus;
+
+    @ApiModelProperty(value = "举报时间")
+    private String reportingDate;
+
+    @ApiModelProperty(value = "举报时间")
+    private String createdTime;
+
+    @ApiModelProperty(value = "业务id")
+    private Integer businessId;
+
+    @ApiModelProperty(value = "处理时间")
+    private String processingTime;
+
+    @ApiModelProperty(value = "举报结果")
+    private String reportResult;
 
-}
+}

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

@@ -0,0 +1,20 @@
+package shop.alien.mapper.second;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import shop.alien.entity.second.vo.SecondUserViolationDetailVo;
+import shop.alien.entity.second.vo.SecondUserViolationVo;
+
+
+/**
+ * 二手交易举报
+ */
+public interface SecondUserViolationMapper extends BaseMapper<SecondUserViolationVo> {
+
+    IPage<SecondUserViolationVo> getUserViolationByPage(IPage<SecondUserViolationVo> page, @Param("reportingUserName") String reportingUserName,
+                                                        @Param("reportingDate") String reportingDate, @Param("processingStatus") String processingStatus,
+                                                        @Param("reportContextType") Integer reportContextType);
+
+    SecondUserViolationDetailVo getUserViolationInfo(@Param("id") Integer id);
+}

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

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="shop.alien.mapper.second.SecondUserViolationMapper">
+    <resultMap id="BaseResultMap" type="shop.alien.entity.second.vo.SecondUserViolationVo">
+        <!--@mbggenerated-->
+        <id column="id" property="id" jdbcType="INTEGER"/>
+        <result column="reported_user_name" property="reportedUserName" jdbcType="VARCHAR"/>
+        <result column="reported_user_phone" property="reportedUserPhone" jdbcType="VARCHAR"/>
+        <result column="reporting_user_name" property="reportingUserName" jdbcType="VARCHAR"/>
+        <result column="reporting_user_phone" property="reportingUserPhone" jdbcType="VARCHAR"/>
+        <result column="report_context" property="reportContext" jdbcType="VARCHAR"/>
+        <result column="report_context_type" property="reportContextType" jdbcType="VARCHAR"/>
+        <result column="dict_detail" property="dictDetail" jdbcType="VARCHAR"/>
+        <result column="processing_context" property="processingContext" jdbcType="VARCHAR"/>
+        <result column="processing_status" property="processingStatus" jdbcType="VARCHAR"/>
+        <result column="business_id" property="businessId" jdbcType="INTEGER"/>
+        <result column="created_time" property="reportingDate" jdbcType="TIMESTAMP"/>
+        <result column="other_reason_content" property="otherReasonContent" jdbcType="VARCHAR"/>
+        <result column="report_evidence_img" property="reportEvidenceImg" jdbcType="VARCHAR"/>
+        <result column="processing_time" property="processingTime" jdbcType="TIMESTAMP"/>
+        <result column="report_result" property="reportResult" jdbcType="VARCHAR"/>
+    </resultMap>
+
+    <!-- 分页查询举报信息 -->
+    <select id="getUserViolationByPage" resultType="shop.alien.entity.second.vo.SecondUserViolationVo">
+        select
+            v.id,
+            u.user_name reporting_user_name,
+            u.user_phone reporting_user_phone,
+            case when v.report_context_type = 4 then '二手商品' else '二手用户' end report_context,
+            v.report_context_type,
+            d.dict_detail dict_detail,
+            case when v.processing_status = 0 then '待处理'
+                when v.processing_status = 1 then '已通过'
+                else '已驳回' end processing_context,
+            v.processing_status,
+            v.created_time as reportingDate,
+            v.business_id
+        from
+        life_user_violation v
+        left join store_dictionary d on v.dict_type = d.type_name and v.dict_id = d.dict_id
+        left join life_user u on u.id = v.reporting_user_id
+        where 1 = 1
+        <if test="reportingUserName != null and reportingUserName != ''">
+            and u.user_name like concat('%',#{reportingUserName},'%')
+        </if>
+        <if test="reportingDate != null and reportingDate != ''">
+            and DATE_FORMAT(v.created_time, '%Y-%m-%d') = #{reportingDate}
+        </if>
+        <if test="processingStatus != null and processingStatus != ''">
+            and v.processing_status = #{processingStatus}
+        </if>
+        <if test="reportContextType != null and reportContextType != ''">
+            and v.report_context_type = #{reportContextType}
+        </if>
+        <if test="reportContextType == null or reportContextType == ''">
+            and (v.report_context_type = 4 or v.report_context_type = 5)
+        </if>
+        order by v.created_time desc
+    </select>
+
+    <!-- 分页查询举报信息 -->
+    <select id="getUserViolationInfo" resultType="shop.alien.entity.second.vo.SecondUserViolationDetailVo">
+        select
+            v.id,
+            case when v.report_context_type = 4 then lu1.user_name else u.user_name end reported_user_name,
+            case when v.report_context_type = 4 then lu1.user_phone else u.user_phone end reported_user_phone,
+            lu.user_name reporting_user_name,
+            lu.user_phone reporting_user_phone,
+            v.created_time,
+            case when v.processing_status = 0 then '待处理' when v.processing_status = 1 then '已通过' else '已驳回' end processing_status,
+            d.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
+        from
+        life_user_violation v
+        left join life_user u on v.reported_user_id = u.id
+        left join life_user lu on v.reporting_user_id = lu.id
+        left join store_dictionary d on v.dict_type = d.type_name
+            and v.dict_id = d.dict_id
+        left join second_goods g on g.id = v.business_id
+        left join life_user lu1 on g.user_id = lu1.id
+        <if test="id != null and id != ''">
+            where v.id = #{id}
+        </if>
+    </select>
+
+</mapper>

+ 47 - 0
alien-second/src/main/java/shop/alien/second/platform/PlatformUserViolationController.java

@@ -0,0 +1,47 @@
+package shop.alien.second.platform;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiSort;
+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.second.vo.SecondUserViolationVo;
+import shop.alien.second.service.PlatformUserViolationService;
+
+/**
+ * 作者:邹建宇
+ * 描述:
+ */
+@Slf4j
+@Api(tags = {"平台-二手举报管理"})
+@ApiSort(1)
+@CrossOrigin
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/platformUserViolation")
+public class PlatformUserViolationController {
+
+    private final PlatformUserViolationService service;
+
+    @ApiOperation("查询举报信息")
+    @PostMapping("/queryUserViolationByPage")
+    public R<IPage<SecondUserViolationVo>> queryUserViolationByPage(@RequestBody SecondUserViolationVo vo) throws Exception {
+        log.info("PlatformUserViolationController.queryUserViolationByPage");
+        IPage<SecondUserViolationVo> page = new Page<>(vo.getPageNum(), vo.getPageSize());
+        return R.data(service.getUserViolationByPage(page, vo.getReportingUserName(), vo.getReportingDate(), vo.getProcessingStatus(), vo.getReportContextType()), "查询成功");
+    }
+
+
+    @ApiOperation("查询举报详情")
+    @GetMapping("/queryUserViolationDetail")
+    public R<SecondUserViolationDetailVo> queryUserViolationDetail(Integer id) throws Exception {
+        log.info("PlatformUserViolationController.queryUserViolationDetail");
+        return R.data(service.getUserViolationDetail(id), "查询成功");
+    }
+
+}

+ 13 - 0
alien-second/src/main/java/shop/alien/second/service/PlatformUserViolationService.java

@@ -0,0 +1,13 @@
+package shop.alien.second.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.second.vo.SecondUserViolationVo;
+
+public interface PlatformUserViolationService extends IService<SecondUserViolationVo> {
+
+    IPage<SecondUserViolationVo> getUserViolationByPage(IPage<SecondUserViolationVo> page, String reportingUserName, String reportingDate, String processingStatus, Integer reportContextType) throws Exception;
+
+    SecondUserViolationDetailVo getUserViolationDetail(Integer id) throws Exception;
+}

+ 126 - 0
alien-second/src/main/java/shop/alien/second/service/impl/PlatformUserViolationServiceImpl.java

@@ -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");
+    }
+
+}

+ 3 - 1
alien-second/src/main/java/shop/alien/second/service/impl/SecondGoodsCategoryServiceImpl.java

@@ -145,7 +145,9 @@ public class SecondGoodsCategoryServiceImpl extends ServiceImpl<SecondGoodsCateg
                     return n1.getCategorySort().compareTo(n2.getCategorySort());
                 })
                 .collect(Collectors.toList());
-        parent.setChildren(children);
+        if (!children.isEmpty()) {
+            parent.setChildren(children);
+        }
         children.forEach(child -> addChildrenRecursive(child, nodeMap));
     }
 }

+ 6 - 9
alien-second/src/main/java/shop/alien/second/service/impl/SecondGoodsReportingServiceImpl.java

@@ -12,14 +12,15 @@ 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.*;
-import shop.alien.entity.store.vo.WebSocketVo;
-import shop.alien.mapper.*;
+import shop.alien.mapper.LifeNoticeMapper;
+import shop.alien.mapper.LifeUserMapper;
+import shop.alien.mapper.LifeUserViolationMapper;
+import shop.alien.mapper.StoreDictionaryMapper;
+import shop.alien.mapper.second.SecondGoodsMapper;
 import shop.alien.mapper.second.SecondGoodsRecordMapper;
-import shop.alien.second.feign.AlienStoreFeign;
 import shop.alien.second.service.SecondGoodsReportingService;
 import shop.alien.second.util.JsonUtils;
 import shop.alien.util.common.Constants;
@@ -58,11 +59,6 @@ public class SecondGoodsReportingServiceImpl implements SecondGoodsReportingServ
     @Autowired
     private final SecondGoodsRecordMapper secondGoodsRecordMapper;
 
-    private final AlienStoreFeign alienStoreFeign;
-
-    @Autowired
-    private final StoreImgMapper storeImgMapper;
-
     @Override
     public SecondReportingVo queryReportingDetail (Integer id) {
         SecondReportingVo secondReportingVo = new SecondReportingVo();
@@ -115,6 +111,7 @@ public class SecondGoodsReportingServiceImpl implements SecondGoodsReportingServ
                 secondReportingVo.setReportingContext(context);
             }
         }
+
         secondReportingVo.setFeedbackContext("平台已受理,感谢您的反馈!");
         secondReportingVo.setReportingTime(lifeNotice.getCreatedTime());
         secondReportingVo.setFeedbackTime(lifeNotice.getCreatedTime());