Эх сурвалжийг харах

Merge branch 'zjy' of alien/alien_cloud into dev

zjy 1 сар өмнө
parent
commit
e0c1ccb76d

+ 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;
 }

+ 4 - 0
alien-entity/src/main/java/shop/alien/entity/second/vo/SecondGoodsVo.java

@@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
 import lombok.Data;
 import shop.alien.entity.second.SecondGoods;
 
@@ -95,6 +96,9 @@ public class SecondGoodsVo extends SecondGoods {
     @ApiModelProperty(value = "屏蔽id")
     private String shieldId;
 
+    @ApiModelProperty(value = "商品id")
+    private Integer goodsId;
+
     @ApiModelProperty(value = "屏蔽商品IDList")
     private List<Integer> shieldedGoodsIds;
 

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

@@ -0,0 +1,29 @@
+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 List<Map<String, Object>> imgList;
+
+    // 商品信息
+    private SecondGoodsVo secondGoods;
+
+
+
+}

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

@@ -1,31 +1,58 @@
 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 lombok.NoArgsConstructor;
 import shop.alien.entity.store.LifeUserViolation;
 
+import java.io.Serializable;
+import java.util.Date;
 import java.util.List;
 
 /**
- * <p>
- * 用户举报
- * </p>
- *
- * @author ssk
- * @since 2025-04-29
+ * 二手商品类别表
  */
 @Data
-@EqualsAndHashCode(callSuper = false)
-@Accessors(chain = true)
-@ApiModel(value="LifeUserViolation对象", description="用户举报")
+@JsonInclude
+@NoArgsConstructor
+@ApiModel(value = "SecondUserViolation对象", description = "二手交易平台管理举报")
 public class SecondUserViolationVo extends LifeUserViolation {
-
     private static final long serialVersionUID = 1L;
 
+    @ApiModelProperty(value = "分页页数")
+    private Integer pageNum;
+
+    @ApiModelProperty(value = "分页条数")
+    private Integer pageSize;
+
+    @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 = "举报时间")
+    private String reportingDate;
+
+    @ApiModelProperty(value = "举报枚举")
+    private String dictDetail;
+
+    @ApiModelProperty(value = "举报状态")
+    private String processingContext;
+
     @ApiModelProperty(value = "商品图片")
     private List<String> imgUrl;
 
-}
+}

+ 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") String reportContextType);
+
+    SecondUserViolationDetailVo getUserViolationInfo(@Param("id") Integer id);
+}

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

@@ -0,0 +1,95 @@
+<?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"/>
+        <result column="video_first_frame" property="videoFirstFrame" 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,
+            v.video_first_frame
+        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_record 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>

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

@@ -0,0 +1,57 @@
+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.entity.store.LifeUserViolation;
+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), "查询成功");
+    }
+
+    @ApiOperation("举报审核")
+    @PostMapping("/updateUserViolation")
+    public R<String> updateUserViolation(@RequestBody LifeUserViolation row) throws Exception {
+        log.info("PlatformUserViolationController.queryUserViolationDetail");
+        int num = service.updateUserViolation(row);
+        if(num > 0) return R.success("审核成功");
+        return R.fail("审核失败");
+    }
+
+}

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

@@ -0,0 +1,16 @@
+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;
+import shop.alien.entity.store.LifeUserViolation;
+
+public interface PlatformUserViolationService extends IService<SecondUserViolationVo> {
+
+    IPage<SecondUserViolationVo> getUserViolationByPage(IPage<SecondUserViolationVo> page, String reportingUserName, String reportingDate, String processingStatus, String reportContextType) throws Exception;
+
+    SecondUserViolationDetailVo getUserViolationDetail(Integer id) throws Exception;
+
+    int updateUserViolation(LifeUserViolation row) throws Exception;
+}

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

@@ -0,0 +1,122 @@
+package shop.alien.second.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+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.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 shop.alien.util.common.Constants;
+
+import java.util.*;
+
+@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, String 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 ("4".equals(item.getReportContextType())) {
+                SecondGoodsVo secondGoods = secondGoodsService.dealSecondGoodsRecordInfo(item.getBusinessId());
+                item.setSecondGoods(secondGoods);
+            }
+
+            // 图片list
+            List<Map<String, Object>> list = new ArrayList<>();
+
+            // 查询图片信息
+            LambdaQueryWrapper<StoreImg> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(StoreImg::getStoreId, item.getId());
+            wrapper.eq(StoreImg::getImgType, Constants.ImageType.SECOND_HAND_REPORT);
+            List<StoreImg> imgList = storeImgMapper.selectList(wrapper);
+
+            for (StoreImg img : imgList) {
+                Map<String, Object> map = new HashMap<>();
+                String fileType = img.getImgUrl().substring(img.getImgUrl().lastIndexOf(".") + 1);
+                if (videoFileType.contains(fileType.toLowerCase())) {
+                    map.put("type", "video");
+                } else {
+                    map.put("type", "image");
+                }
+                map.put("imgUrl", img.getImgUrl());
+                list.add(map);
+            }
+            item.setImgList(list);
+            return item;
+        } catch (Exception e) {
+            log.error("PlatformUserViolationServiceImpl.getUserViolationByPage Error Mgs={}", e.getMessage());
+            throw new Exception(e);
+        }
+    }
+
+    @Override
+    public int updateUserViolation(LifeUserViolation row) throws Exception {
+        LambdaUpdateWrapper<LifeUserViolation> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper
+                .eq(LifeUserViolation::getId, row.getId())
+                .set(LifeUserViolation::getProcessingStatus, row.getProcessingStatus())
+                .set(LifeUserViolation::getProcessingTime, new Date())
+                .set(LifeUserViolation::getReportResult, row.getReportResult());
+        return lifeUserViolationMapper.update(null, updateWrapper);
+    }
+
+    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));
     }
 }