新增举报接口
This commit is contained in:
parent
eb87cbb900
commit
5219e2fd1b
@ -34,6 +34,23 @@ public enum DicEnum {
|
||||
|
||||
ES_SEARCH_TYPE_1("1", "高亮查询","esSearchType","es查询方式","精准查询"),
|
||||
ES_SEARCH_TYPE_2("2", "模糊查询","esSearchType","es查询方式","模糊查询"),
|
||||
|
||||
/**
|
||||
* 举报类型
|
||||
*/
|
||||
REPORT_TYPE_1("1", "垃圾信息","reportType","举报类型","垃圾信息"),
|
||||
REPORT_TYPE_2("2", "骚扰辱骂","reportType","举报类型","骚扰辱骂"),
|
||||
REPORT_TYPE_3("3", "色情低俗","reportType","举报类型","色情低俗"),
|
||||
REPORT_TYPE_4("4", "诈骗","reportType","举报类型","诈骗"),
|
||||
REPORT_TYPE_5("5", "其他","reportType","举报类型","其他"),
|
||||
|
||||
/**
|
||||
* 处理状态
|
||||
*/
|
||||
PROCESSING_STATUS_0("0", "待处理","processingStatus","处理状态","垃圾信息"),
|
||||
PROCESSING_STATUS_1("1", "已受理","processingStatus","处理状态","骚扰辱骂"),
|
||||
PROCESSING_STATUS_2("2", "已驳回","processingStatus","处理状态","色情低俗"),
|
||||
PROCESSING_STATUS_3("3", "处理已完结","processingStatus","处理状态","诈骗"),
|
||||
;
|
||||
;
|
||||
private String code;
|
||||
|
||||
@ -23,10 +23,9 @@ import com.suisung.mall.common.modules.store.ShopStoreEmployee;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreEmployeeKefu;
|
||||
import com.suisung.mall.common.modules.store.ShopStoreEmployeeRightsGroup;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@ -300,5 +299,9 @@ public interface ShopService {
|
||||
@PostMapping(value = "/mobile/shop/orderlkl/pay/notify/update/order")
|
||||
boolean lklPayNotifyUpdateShopOrderLkl(@RequestBody JSONObject lklPayNotifyDataJson);
|
||||
|
||||
|
||||
@PostMapping(value = "/mobile/shop/oss/upload",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
CommonResult uploadFile(@RequestPart(name = "upfile") MultipartFile file);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,114 @@
|
||||
package com.suisung.mall.common.modules.sns;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("sns_user_report")
|
||||
@ApiModel("社交平台用户举报记录表(含审计跟踪)")
|
||||
public class SnsUserReport {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "自增主键ID", example = "1")
|
||||
private Long id;
|
||||
|
||||
@TableField(value = "reporter_user_id",updateStrategy =FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "举报人用户ID", required = true, example = "10001")
|
||||
private Long reporterUserId;
|
||||
|
||||
@TableField(value = "reporter_nickname",updateStrategy =FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "举报人用户名(昵称)", required = true, example = "用户A")
|
||||
private String reporterNickname;
|
||||
|
||||
@TableField(value = "reported_user_id",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "被举报人用户ID", required = true, example = "20002")
|
||||
@NotNull(message = "被举报人用户ID不能为空")
|
||||
private Long reportedUserId;
|
||||
|
||||
@TableField(value = "reported_nickname",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@NotEmpty(message = "被举报人用户名不能为空")
|
||||
@ApiModelProperty(value = "被举报人用户名(昵称)", required = true, example = "用户B")
|
||||
private String reportedNickname;
|
||||
|
||||
|
||||
@TableField(value = "reported_phone",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "被举报人手机号(可为空,根据隐私设置显示)", example = "13800138000")
|
||||
private String reportedPhone;
|
||||
|
||||
@TableField(value = "reporter_phone",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "举报人手机号(匿名举报可为空)", example = "13800138000")
|
||||
private String reporterPhone;
|
||||
|
||||
@TableField(value = "report_category",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(
|
||||
value = "举报类别:1-垃圾信息 2-骚扰辱骂 3-色情低俗 4-诈骗 5-其他",
|
||||
required = true,
|
||||
example = "2"
|
||||
)
|
||||
@NotNull(message = "举报类型不能为空")
|
||||
private Integer reportCategory;
|
||||
|
||||
@TableField(value = "report_content",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "举报详细内容", required = true, example = "该用户多次发送骚扰信息")
|
||||
@NotEmpty(message = "举报内容不能为空")
|
||||
private String reportContent;
|
||||
|
||||
@TableField(value = "evidence_images",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(
|
||||
value = "举报图片佐证,JSON格式:[{url: \"\", description: \"\"}, ...]",
|
||||
example = "[{\"url\":\"https://example.com/1.jpg\",\"description\":\"骚扰截图\"}]"
|
||||
)
|
||||
@NotEmpty(message = "举报图片佐证不能为空")
|
||||
private String evidenceImages;
|
||||
|
||||
@TableField(value = "processing_status",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(
|
||||
value = "处理状态:0-待处理 1-已受理 2-已驳回 3-处理已完结",
|
||||
example = "0"
|
||||
)
|
||||
private Integer processingStatus;
|
||||
|
||||
@TableField(value = "processing_result",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "管理员处理结果描述", example = "已核实并封禁账号7天")
|
||||
private String processingResult;
|
||||
|
||||
@TableField(value = "processing_evidence_images",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(
|
||||
value = "处理结果佐证图片,JSON格式:[{url: \"\", description: \"\"}, ...]",
|
||||
example = "[{\"url\":\"https://example.com/admin.jpg\",\"description\":\"处理记录截图\"}]"
|
||||
)
|
||||
private String processingEvidenceImages;
|
||||
|
||||
@TableField(value = "created_by",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "创建人用户ID(通常与举报人ID一致)", required = true, example = "10001")
|
||||
private Long createdBy;
|
||||
|
||||
@TableField(value = "updated_by",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "最后修改人用户ID(管理员)", example = "90001")
|
||||
private Long updatedBy;
|
||||
|
||||
@TableField(value = "deleted_at",updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "逻辑删除时间戳(NULL表示未删除)", example = "2023-01-01T00:00:00")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date deletedAt;
|
||||
|
||||
@TableField(value = "created_at", updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "记录创建时间", example = "2023-01-01T00:00:00")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createdAt;
|
||||
|
||||
@TableField(value = "updated_at", updateStrategy = FieldStrategy.NOT_EMPTY)
|
||||
@ApiModelProperty(value = "记录最后更新时间", example = "2023-01-02T00:00:00")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updatedAt;
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.suisung.mall.common.modules.store;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("shop_store_member")
|
||||
@ApiModel(value = "ShopStoreMember", description = "店铺会员表")
|
||||
public class ShopStoreMember {
|
||||
@TableId(value = "store_member_id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "店铺会员ID", example = "10001")
|
||||
private Integer storeMemberId;
|
||||
|
||||
@ApiModelProperty(value = "用户ID", example = "20001")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "店铺ID", example = "30001")
|
||||
private Integer storeId;
|
||||
|
||||
@ApiModelProperty(value = "店铺名称", example = "旗舰店")
|
||||
private String storeName;
|
||||
|
||||
@ApiModelProperty(value = "首次消费时间")
|
||||
private Date firstPurchaseTime;
|
||||
|
||||
@ApiModelProperty(value = "累计消费金额", example = "1500.00")
|
||||
private BigDecimal totalConsumption;
|
||||
|
||||
@ApiModelProperty(value = "最近消费时间")
|
||||
private Date lastPurchaseTime;
|
||||
|
||||
@ApiModelProperty(value = "会员等级ID", example = "2")
|
||||
private Integer memberLevelId;
|
||||
|
||||
@ApiModelProperty(value = "等级名称", example = "铂金会员")
|
||||
private String memberLevelName;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createdAt;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updatedAt;
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.suisung.mall.common.modules.store;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("shop_store_member_level")
|
||||
@ApiModel(value = "ShopStoreMemberLevel", description = "店铺会员等级表")
|
||||
public class ShopStoreMemberLevel {
|
||||
@TableId(value = "user_level_id", type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "等级编号", example = "1")
|
||||
private Integer userLevelId;
|
||||
|
||||
@ApiModelProperty(value = "等级名称", example = "黄金会员")
|
||||
private String userLevelName;
|
||||
|
||||
@ApiModelProperty(value = "累计消费额度", example = "1000.00")
|
||||
private BigDecimal userLevelSpend;
|
||||
|
||||
@ApiModelProperty(value = "折扣率百分比", example = "95.00")
|
||||
private BigDecimal userLevelRate;
|
||||
|
||||
@ApiModelProperty(value = "等级修改时间")
|
||||
private Date userLevelTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createdAt;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updatedAt;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.suisung.mall.sns.Converter;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.suisung.mall.common.modules.sns.SnsUserReport;
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class StringToSnsUserReportConverter implements Converter<String, SnsUserReport> {
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Override
|
||||
public SnsUserReport convert(String source) {
|
||||
try {
|
||||
return objectMapper.readValue(source, SnsUserReport.class);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("JSON 解析失败: " + source, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,12 +3,13 @@ package com.suisung.mall.sns.config;
|
||||
import com.suisung.mall.common.constant.AuthConstant;
|
||||
import feign.RequestInterceptor;
|
||||
import feign.RequestTemplate;
|
||||
import feign.form.spring.SpringFormEncoder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import feign.codec.Encoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@Configuration
|
||||
@ -28,4 +29,9 @@ public class FeignConfig {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Encoder feignFormEncoder() {
|
||||
return new SpringFormEncoder();
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,11 @@
|
||||
package com.suisung.mall.sns.config;
|
||||
|
||||
|
||||
import com.suisung.mall.sns.Converter.StringToSnsUserReportConverter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.support.ResourceBundleMessageSource;
|
||||
import org.springframework.format.FormatterRegistry;
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@ -17,6 +19,8 @@ import java.util.Locale;
|
||||
*/
|
||||
@Configuration
|
||||
public class I18nConfig implements WebMvcConfigurer {
|
||||
private final StringToSnsUserReportConverter stringToSnsUserReportConverter;
|
||||
|
||||
/**
|
||||
* session区域解析器
|
||||
* @return
|
||||
@ -81,4 +85,15 @@ public class I18nConfig implements WebMvcConfigurer {
|
||||
resourceBundleMessageSource.setBasenames("i18n/messages");
|
||||
return resourceBundleMessageSource;
|
||||
}
|
||||
|
||||
public I18nConfig(StringToSnsUserReportConverter stringToSnsUserReportConverter) {
|
||||
this.stringToSnsUserReportConverter = stringToSnsUserReportConverter;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addFormatters(FormatterRegistry registry) {
|
||||
// 注册自定义转换器
|
||||
registry.addConverter(stringToSnsUserReportConverter);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,62 @@
|
||||
package com.suisung.mall.sns.controller.admin;
|
||||
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.modules.sns.SnsUserReport;
|
||||
import com.suisung.mall.sns.service.SnsUserReportService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Api(tags = "社交平台用户举报记录控制器")
|
||||
@RequestMapping("/admin/sns/snsUserReport")
|
||||
@RestController
|
||||
public class SnsUserReportController {
|
||||
|
||||
@Resource
|
||||
private SnsUserReportService snsUserReportService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "举报记录表-分页列表查询", notes = "举报记录表-分页列表查询")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult list(@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
|
||||
return snsUserReportService.findPageSnsUserReport(pageNum, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 举报提交
|
||||
*
|
||||
* @param snsUserReport
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "举报记录表-举报提交", notes = "举报记录表-举报提交")
|
||||
@RequestMapping(value = "/submitReport", method = RequestMethod.POST)
|
||||
public CommonResult submitReport(@Validated @RequestParam("snsUserReport") SnsUserReport snsUserReport,@RequestParam("files") List<MultipartFile> files) {
|
||||
return snsUserReportService.submitReport(snsUserReport,files);
|
||||
}
|
||||
|
||||
/**
|
||||
* 举报处理
|
||||
* @param snsUserReport
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "举报处理-分页列表查询", notes = "举报处理-分页列表查询")
|
||||
@RequestMapping(value = "/dealReport", method = RequestMethod.POST)
|
||||
public CommonResult dealReport(@RequestBody SnsUserReport snsUserReport) {
|
||||
return snsUserReportService.dealReport(snsUserReport);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.suisung.mall.sns.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.suisung.mall.common.modules.sns.SnsUserReport;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 主播表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author Xinze
|
||||
* @since 2021-04-14
|
||||
*/
|
||||
|
||||
@Repository
|
||||
public interface SnsUserReportMapper extends BaseMapper<SnsUserReport> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.suisung.mall.sns.pojo.dto;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ReportImageData {
|
||||
@SerializedName("url")
|
||||
private String url;
|
||||
@SerializedName("description")
|
||||
private String description;
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.suisung.mall.sns.service;
|
||||
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.modules.sns.SnsUserReport;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 群组 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author Xinze
|
||||
* @since 2022-04-01
|
||||
*/
|
||||
public interface SnsUserReportService extends IBaseService<SnsUserReport> {
|
||||
CommonResult findPageSnsUserReport(int pageNo,int pageSize);
|
||||
|
||||
CommonResult submitReport(SnsUserReport snsUserReport, List<MultipartFile> files);
|
||||
|
||||
CommonResult dealReport(SnsUserReport snsUserReport);
|
||||
}
|
||||
@ -0,0 +1,262 @@
|
||||
package com.suisung.mall.sns.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.domain.UserDto;
|
||||
import com.suisung.mall.common.enums.DicEnum;
|
||||
import com.suisung.mall.common.exception.ApiException;
|
||||
import com.suisung.mall.common.feignService.ShopService;
|
||||
import com.suisung.mall.common.modules.sns.SnsUserReport;
|
||||
import com.suisung.mall.common.utils.ContextUtil;
|
||||
import com.suisung.mall.common.utils.StringUtils;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.sns.mapper.SnsUserReportMapper;
|
||||
import com.suisung.mall.sns.pojo.dto.ReportImageData;
|
||||
import com.suisung.mall.sns.service.SnsUserReportService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@Service
|
||||
public class SnsUserReportServiceImpl extends BaseServiceImpl<SnsUserReportMapper, SnsUserReport> implements SnsUserReportService {
|
||||
|
||||
@Autowired
|
||||
private ShopService shopService;
|
||||
|
||||
private final static Set<Integer> processingStatusList= Collections.unmodifiableSet(new HashSet<>(
|
||||
Arrays.asList(1,2,3)
|
||||
));
|
||||
|
||||
private final static Set<Integer> reportCategorys= Collections.unmodifiableSet(new HashSet<>(
|
||||
Arrays.asList(1,2,3, 4,5)
|
||||
));
|
||||
private final static List<String> domains=Arrays.asList("https://static.gpxscs.cn","https://media-mall-prod");//本系统静态路径
|
||||
|
||||
private final static Integer limtFiels=3;
|
||||
|
||||
@Override
|
||||
public CommonResult findPageSnsUserReport(int pageNo, int pageSize) {
|
||||
SnsUserReport snsUserReport = new SnsUserReport();
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
assert userDto != null;
|
||||
if(userDto.getRole_id()!=9){
|
||||
snsUserReport.setReporterUserId(Long.valueOf(userDto.getId()));
|
||||
}
|
||||
String reporterPhone= getParameter("reporterPhone");
|
||||
String reportedPhone= getParameter("reportedPhone");
|
||||
String reporterNickname= getParameter("reporterNickname");
|
||||
String reportedNickname= getParameter("reportedNickname");
|
||||
String reportedUserId= getParameter("reportedUserId");
|
||||
if(StringUtils.isNotBlank(reporterPhone)){
|
||||
snsUserReport.setReporterPhone(reporterPhone);
|
||||
}
|
||||
if(StringUtils.isNotBlank(reportedPhone)){
|
||||
snsUserReport.setReportedPhone(reportedPhone);
|
||||
}
|
||||
if(StringUtils.isNotBlank(reporterNickname)){
|
||||
snsUserReport.setReporterNickname(reporterNickname);
|
||||
}
|
||||
if(StringUtils.isNotEmpty(reportedNickname)){
|
||||
snsUserReport.setReportedNickname(reportedNickname);
|
||||
}
|
||||
if(StringUtils.isNotEmpty(reportedUserId)){
|
||||
snsUserReport.setReportedUserId(Long.valueOf(reportedUserId));
|
||||
}
|
||||
QueryWrapper<SnsUserReport> queryWrapper = new QueryWrapper<>(snsUserReport);
|
||||
return CommonResult.success(this.lists(queryWrapper,pageNo,pageSize));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
public CommonResult submitReport(SnsUserReport snsUserReport,List<MultipartFile> files) {
|
||||
|
||||
if(files.isEmpty()){
|
||||
return CommonResult.failed("举报佐证材料不能为空");
|
||||
}
|
||||
|
||||
if(files.size()>limtFiels){
|
||||
return CommonResult.failed("文件数量不能超过3个");
|
||||
}
|
||||
List<ReportImageData> reportImageDatas = new ArrayList<>();
|
||||
int i=1;//佐证材料编号
|
||||
for(MultipartFile file:files){
|
||||
int index=0;
|
||||
while (index<3){
|
||||
try {
|
||||
CommonResult commonResult= shopService.uploadFile(file);
|
||||
Map<String, Object> data = (Map<String, Object>) commonResult.getData();
|
||||
ReportImageData reportImageData=new ReportImageData();
|
||||
if(ObjectUtil.isNotEmpty(data.get("url"))){
|
||||
reportImageData.setUrl(String.valueOf(data.get("url")));
|
||||
reportImageData.setDescription("举报佐证材料"+i);
|
||||
reportImageDatas.add(reportImageData);
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
}catch (Exception e){
|
||||
index++;
|
||||
if(index==3){
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Gson gson = new Gson();
|
||||
String evedenceImageDatas= gson.toJson(reportImageDatas);
|
||||
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
assert userDto != null;
|
||||
long userId = userDto.getId();
|
||||
if(StringUtils.isNotEmpty(snsUserReport.getReporterPhone())){
|
||||
if(!PhoneUtil.isMobile(snsUserReport.getReporterPhone())){
|
||||
throw new ApiException("举报人手机号码格式不正确");
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotEmpty(snsUserReport.getReportedPhone())){
|
||||
if(!PhoneUtil.isMobile(snsUserReport.getReportedPhone())){
|
||||
throw new ApiException("被举报人手机号码格式不正确");
|
||||
}
|
||||
}
|
||||
Integer reportCategory= snsUserReport.getReportCategory();
|
||||
if(!reportCategorys.contains(reportCategory)){
|
||||
return CommonResult.failed("不存在该举报类型");
|
||||
}
|
||||
SnsUserReport saveSnsUserReport = new SnsUserReport();
|
||||
saveSnsUserReport.setReportedPhone(snsUserReport.getReportedPhone());
|
||||
saveSnsUserReport.setReporterPhone(snsUserReport.getReporterPhone());
|
||||
saveSnsUserReport.setReportedNickname(snsUserReport.getReportedNickname());
|
||||
saveSnsUserReport.setReportCategory(snsUserReport.getReportCategory());
|
||||
saveSnsUserReport.setReportedUserId(snsUserReport.getReportedUserId());
|
||||
saveSnsUserReport.setEvidenceImages(evedenceImageDatas);
|
||||
saveSnsUserReport.setReportContent(snsUserReport.getReportContent());
|
||||
saveSnsUserReport.setCreatedBy(userId);
|
||||
saveSnsUserReport.setReporterUserId(Long.valueOf(userDto.getId()));
|
||||
saveSnsUserReport.setReporterNickname(userDto.getUser_nickname());
|
||||
saveSnsUserReport.setProcessingStatus(Integer.valueOf(DicEnum.PROCESSING_STATUS_0.getCode()));
|
||||
saveSnsUserReport.setCreatedAt(new Date());
|
||||
saveSnsUserReport.setUpdatedAt(new Date());
|
||||
if(!this.save(saveSnsUserReport)){
|
||||
return CommonResult.success("提交失败,请联系管理员");
|
||||
}
|
||||
return CommonResult.success("提交成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CommonResult dealReport(SnsUserReport snsUserReport) {
|
||||
//校验参数
|
||||
UserDto userDto= ContextUtil.getCurrentUser();
|
||||
assert userDto != null;
|
||||
if(userDto.getRole_id()!=9){
|
||||
return CommonResult.failed("权限不足");
|
||||
}
|
||||
if(ObjectUtil.isEmpty(snsUserReport.getId())){
|
||||
return CommonResult.failed("缺少唯一值");
|
||||
}
|
||||
QueryWrapper<SnsUserReport> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("id", snsUserReport.getId());
|
||||
SnsUserReport userReport = this.findOne(queryWrapper);
|
||||
if(userReport == null){
|
||||
return CommonResult.failed("不存在该举报内容");
|
||||
}
|
||||
Integer resultStatus=userReport.getProcessingStatus();
|
||||
if(ObjectUtil.equals(resultStatus,Integer.valueOf(DicEnum.PROCESSING_STATUS_2.getCode()))||
|
||||
ObjectUtil.equals(resultStatus,Integer.valueOf(DicEnum.PROCESSING_STATUS_3.getCode()))){
|
||||
return CommonResult.failed("该举报已处理,无需处理");
|
||||
}
|
||||
//处理业务
|
||||
Integer processingStatus= snsUserReport.getProcessingStatus();
|
||||
if(!processingStatusList.contains(processingStatus)){
|
||||
return CommonResult.failed("不存在该受理类型");
|
||||
}
|
||||
SnsUserReport saveSnsUserReport=new SnsUserReport();
|
||||
saveSnsUserReport.setUpdatedBy(Long.valueOf(userDto.getId()));
|
||||
saveSnsUserReport.setUpdatedAt(new Date());
|
||||
saveSnsUserReport.setId(userReport.getId());
|
||||
saveSnsUserReport.setProcessingResult(snsUserReport.getProcessingResult());
|
||||
saveSnsUserReport.setProcessingEvidenceImages(snsUserReport.getProcessingEvidenceImages());
|
||||
String processingStatusStr=String.valueOf(processingStatus);
|
||||
if(ObjectUtil.equals(DicEnum.PROCESSING_STATUS_1.getCode(),processingStatusStr)){//受理
|
||||
saveSnsUserReport.setProcessingStatus(Integer.valueOf(DicEnum.PROCESSING_STATUS_1.getCode()));
|
||||
}
|
||||
if(ObjectUtil.equals(DicEnum.PROCESSING_STATUS_2.getCode(),processingStatusStr)){//已驳回
|
||||
if(StringUtils.isEmpty(saveSnsUserReport.getProcessingResult())){
|
||||
return CommonResult.failed("驳回需要填写结果描述");
|
||||
}
|
||||
saveSnsUserReport.setProcessingStatus(Integer.valueOf(DicEnum.PROCESSING_STATUS_2.getCode()));
|
||||
saveSnsUserReport.setProcessingResult(snsUserReport.getProcessingResult());
|
||||
}
|
||||
if(ObjectUtil.equals(DicEnum.PROCESSING_STATUS_3.getCode(),processingStatusStr)){//处理已完结
|
||||
if(StringUtils.isEmpty(saveSnsUserReport.getProcessingResult())){
|
||||
return CommonResult.failed("处理已完结需要填写结果描述");
|
||||
}
|
||||
if(StringUtils.isEmpty(saveSnsUserReport.getProcessingEvidenceImages())){
|
||||
return CommonResult.failed("处理已完结需要填写佐证材料");
|
||||
}
|
||||
Gson gson=new Gson();
|
||||
List<ReportImageData> reportImageData= gson.fromJson(saveSnsUserReport.getProcessingEvidenceImages(), new TypeToken<List<ReportImageData>>(){}.getType());
|
||||
String evedenceImageDatas= gson.toJson(reportImageData);
|
||||
if(!checkoutImageUrl(reportImageData)){
|
||||
return CommonResult.failed("处理佐证材料格式不正确");
|
||||
}
|
||||
saveSnsUserReport.setProcessingStatus(Integer.valueOf(DicEnum.PROCESSING_STATUS_3.getCode()));
|
||||
saveSnsUserReport.setProcessingResult(snsUserReport.getProcessingResult());
|
||||
saveSnsUserReport.setProcessingEvidenceImages(evedenceImageDatas);
|
||||
}
|
||||
if(this.edit(saveSnsUserReport)){
|
||||
return CommonResult.success("处理成功");
|
||||
}
|
||||
return CommonResult.success("处理失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验佐证材料格式
|
||||
* @param reportImageDatas
|
||||
* @return
|
||||
*/
|
||||
private boolean checkoutImageUrl(List<ReportImageData> reportImageDatas){
|
||||
if(reportImageDatas==null){
|
||||
return false;
|
||||
}
|
||||
if(reportImageDatas.isEmpty()){
|
||||
return false;
|
||||
}
|
||||
for(ReportImageData reportImageData:reportImageDatas){
|
||||
if(StringUtils.isEmpty(reportImageData.getUrl())){
|
||||
return false;
|
||||
}
|
||||
boolean flag=false;
|
||||
for(String domain:domains){//校验https地址
|
||||
if(reportImageData.getUrl().contains(domain)){
|
||||
flag=true;
|
||||
}
|
||||
}
|
||||
if(!flag){
|
||||
return false;
|
||||
}
|
||||
if(StringUtils.isEmpty(reportImageData.getDescription())){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(PhoneUtil.isMobile("18278596806"));
|
||||
|
||||
Gson gson=new GsonBuilder().serializeNulls().create();
|
||||
List<ReportImageData> reportImageData= gson.fromJson("[{\"url\": \"https://example.com/image.jpg\", \"description\": \"实例描述\"}]", new TypeToken<List<ReportImageData>>(){}.getType());
|
||||
|
||||
System.out.println(new SnsUserReportServiceImpl().checkoutImageUrl(reportImageData));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user