feat(communityCenter): 举报
parent
5f354654ab
commit
43a6bc98b8
|
@ -119,4 +119,15 @@ public class PublishController {
|
|||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 举报
|
||||
*/
|
||||
@ApiOperation(value = "举报")
|
||||
@PostMapping("report")
|
||||
public R<Object> reportPublish(@RequestBody @Valid PublishReportRes publishReportRes) {
|
||||
publishService.reportPublish(publishReportRes);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,18 +3,17 @@ package com.mcwl.web.controller.communityCenter;
|
|||
import com.mcwl.common.core.domain.R;
|
||||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.communityCenter.domain.dto.EditPublishReportStatusRes;
|
||||
import com.mcwl.communityCenter.domain.dto.PublishReportRes;
|
||||
import com.mcwl.communityCenter.service.PublishReportService;
|
||||
import com.mcwl.communityCenter.service.PublishService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 发布举报
|
||||
|
@ -25,21 +24,8 @@ import javax.validation.Valid;
|
|||
@RequiredArgsConstructor
|
||||
public class PublishReportController {
|
||||
|
||||
private final PublishService publishService;
|
||||
|
||||
private final PublishReportService publishReportService;
|
||||
|
||||
|
||||
/**
|
||||
* 举报
|
||||
*/
|
||||
@ApiOperation(value = "举报")
|
||||
@PostMapping("report")
|
||||
public R<Object> reportPublish(@RequestBody @Valid PublishReportRes publishReportRes) {
|
||||
publishService.reportPublish(publishReportRes);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取举报列表
|
||||
*/
|
||||
|
@ -49,6 +35,26 @@ public class PublishReportController {
|
|||
return publishReportService.getReportList(pageDomain);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改状态
|
||||
*/
|
||||
@ApiOperation(value = "修改状态")
|
||||
@PostMapping("updateStatus")
|
||||
public R<Object> updateStatus(@RequestBody @Valid EditPublishReportStatusRes editPublishReportStatusRes) {
|
||||
publishReportService.updateStatus(editPublishReportStatusRes);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除举报
|
||||
*/
|
||||
@ApiOperation(value = "删除举报")
|
||||
@GetMapping("delete")
|
||||
public R<Object> delete(@Valid @NotNull(message = "举报id不能为空") Long id) {
|
||||
publishReportService.removeReportById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -44,9 +44,9 @@ public class PublishReport extends BaseEntity {
|
|||
private Integer reportType;
|
||||
|
||||
/**
|
||||
* 举报内容
|
||||
* 举报描述
|
||||
*/
|
||||
private String content;
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 状态(0未处理 1已处理 )
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package com.mcwl.communityCenter.domain.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 修改举报状态请求参数
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "修改举报状态请求参数")
|
||||
public class EditPublishReportStatusRes {
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty(value = "租户id", required = true)
|
||||
@NotNull(message = "租户id不能为空")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
@ApiModelProperty(value = "社区id", required = true)
|
||||
@NotNull(message = "社区id不能为空")
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 发布id
|
||||
*/
|
||||
@ApiModelProperty(value = "发布id", required = true)
|
||||
@NotNull(message = "发布id不能为空")
|
||||
private Long publishId;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ApiModelProperty(value = "状态", required = true)
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
}
|
|
@ -45,6 +45,6 @@ public class PublishReportRes {
|
|||
* 举报内容
|
||||
*/
|
||||
@ApiModelProperty(value = "举报内容")
|
||||
private String content;
|
||||
private String description;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
package com.mcwl.communityCenter.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 举报表
|
||||
*/
|
||||
|
||||
@Builder
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(description = "举报返回参数")
|
||||
public class PublishReportVo {
|
||||
|
||||
@ApiModelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
@ApiModelProperty(value = "社区id")
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 发布id
|
||||
*/
|
||||
@ApiModelProperty(value = "发布id")
|
||||
private Long publishId;
|
||||
|
||||
/**
|
||||
* 举报人
|
||||
*/
|
||||
@ApiModelProperty(value = "举报人")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 举报类型 字典值
|
||||
*/
|
||||
@ApiModelProperty(value = "举报类型")
|
||||
private String reportType;
|
||||
|
||||
/**
|
||||
* 状态(0未处理 1已处理 )
|
||||
*/
|
||||
@ApiModelProperty(value = "状态(0未处理 1已处理 )")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@ApiModelProperty(value = "内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 图片url
|
||||
*/
|
||||
@ApiModelProperty(value = "图片url")
|
||||
private String imgUrl;
|
||||
|
||||
/**
|
||||
* 文件url
|
||||
*/
|
||||
@ApiModelProperty(value = "文件url")
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 举报时间
|
||||
*/
|
||||
@ApiModelProperty(value = "举报时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
}
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mcwl.communityCenter.domain.Publish;
|
||||
import com.mcwl.communityCenter.domain.PublishReport;
|
||||
import com.mcwl.communityCenter.domain.dto.EditPublishReportStatusRes;
|
||||
import com.mcwl.communityCenter.domain.dto.MyPublishPageRes;
|
||||
import com.mcwl.communityCenter.domain.dto.PublishPageRes;
|
||||
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||
|
@ -18,4 +19,10 @@ public interface PublishReportMapper extends BaseMapper<PublishReport> {
|
|||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void insertReport(@Param("publishReport") PublishReport publishReport);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void updateStatus(@Param("editPublishReportStatusRes") EditPublishReportStatusRes editPublishReportStatusRes);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
void deleteReportById(@Param("id") Long id);
|
||||
}
|
||||
|
|
|
@ -11,10 +11,15 @@ import com.mcwl.communityCenter.domain.dto.*;
|
|||
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public interface PublishReportService extends IService<PublishReport> {
|
||||
|
||||
void saveReport(PublishReport publishReport);
|
||||
|
||||
TableDataInfo getReportList(@Valid PageDomain pageDomain);
|
||||
|
||||
void updateStatus(@Valid EditPublishReportStatusRes editPublishReportStatusRes);
|
||||
|
||||
void removeReportById(Long id);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.mcwl.common.core.domain.entity.SysUser;
|
|||
import com.mcwl.common.core.page.PageDomain;
|
||||
import com.mcwl.common.core.page.TableDataInfo;
|
||||
import com.mcwl.common.exception.ServiceException;
|
||||
import com.mcwl.common.utils.DictUtils;
|
||||
import com.mcwl.common.utils.SecurityUtils;
|
||||
import com.mcwl.common.utils.StringUtils;
|
||||
import com.mcwl.communityCenter.constant.AdviceConstant;
|
||||
|
@ -18,9 +19,11 @@ import com.mcwl.communityCenter.domain.*;
|
|||
import com.mcwl.communityCenter.domain.dto.*;
|
||||
import com.mcwl.communityCenter.domain.vo.CommentVo;
|
||||
import com.mcwl.communityCenter.domain.vo.PersonHomeVo;
|
||||
import com.mcwl.communityCenter.domain.vo.PublishReportVo;
|
||||
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||
import com.mcwl.communityCenter.mapper.*;
|
||||
import com.mcwl.communityCenter.service.*;
|
||||
import com.mcwl.system.init.DictInit;
|
||||
import com.mcwl.system.service.ISysUserService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -35,6 +38,9 @@ import java.util.Objects;
|
|||
@RequiredArgsConstructor
|
||||
public class PublishReportServiceImpl extends ServiceImpl<PublishReportMapper, PublishReport> implements PublishReportService {
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
private final PublishMapper publishMapper;
|
||||
|
||||
@Override
|
||||
public void saveReport(PublishReport publishReport) {
|
||||
|
@ -46,13 +52,58 @@ public class PublishReportServiceImpl extends ServiceImpl<PublishReportMapper, P
|
|||
@Override
|
||||
public TableDataInfo getReportList(PageDomain pageDomain) {
|
||||
Page<PublishReport> page = new Page<>(pageDomain.getPageNum(), pageDomain.getPageSize());
|
||||
baseMapper.selectPage(page, new LambdaQueryWrapper<PublishReport>());
|
||||
List<PublishReport> records = page.getRecords();
|
||||
baseMapper.selectPage(page, new LambdaQueryWrapper<PublishReport>()
|
||||
.orderByAsc(PublishReport::getStatus)
|
||||
.orderByDesc(PublishReport::getCreateTime));
|
||||
|
||||
List<PublishReport> publishReportList = page.getRecords();
|
||||
List<PublishReportVo> publishReportVoList = new ArrayList<>();
|
||||
|
||||
for (PublishReport publishReport : publishReportList) {
|
||||
PublishReportVo publishReportVo = BeanUtil.copyProperties(publishReport, PublishReportVo.class);
|
||||
publishReportVo.setUserName(sysUserService.selectUserById(publishReport.getUserId()).getUserName());
|
||||
|
||||
publishReportVo.setReportType(DictInit.getDictValue("community_report", publishReport.getReportType().toString()));
|
||||
|
||||
|
||||
|
||||
Publish publish = publishMapper.selectByIdAndTenantIdAndCommunityId(publishReport.getPublishId(), publishReport.getTenantId(), publishReport.getCommunityId());
|
||||
|
||||
if (Objects.nonNull(publish)) {
|
||||
publishReportVo.setContent(publish.getContent());
|
||||
publishReportVo.setImgUrl(publish.getImageUrl());
|
||||
publishReportVo.setFileUrl(publish.getFileUrl());
|
||||
}
|
||||
|
||||
publishReportVoList.add(publishReportVo);
|
||||
}
|
||||
|
||||
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setRows(records);
|
||||
tableDataInfo.setRows(publishReportVoList);
|
||||
tableDataInfo.setTotal(page.getTotal());
|
||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
||||
tableDataInfo.setMsg("查询成功");
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatus(EditPublishReportStatusRes editPublishReportStatusRes) {
|
||||
baseMapper.updateStatus(editPublishReportStatusRes);
|
||||
Long tenantId = editPublishReportStatusRes.getTenantId();
|
||||
Long communityId = editPublishReportStatusRes.getCommunityId();
|
||||
Long publishId = editPublishReportStatusRes.getPublishId();
|
||||
if (editPublishReportStatusRes.getStatus() == 2) {
|
||||
PublishRemoveRes publishRemoveRes = new PublishRemoveRes();
|
||||
publishRemoveRes.setTenantId(tenantId);
|
||||
publishRemoveRes.setCommunityId(communityId);
|
||||
publishRemoveRes.setPublishId(publishId);
|
||||
publishMapper.removePublish(publishRemoveRes);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeReportById(Long id) {
|
||||
baseMapper.deleteReportById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,20 @@
|
|||
<mapper namespace="com.mcwl.communityCenter.mapper.PublishReportMapper">
|
||||
|
||||
<insert id="insertReport">
|
||||
INSERT INTO cc_report(tenant_id, community_id, publish_id, user_id, report_type, content)
|
||||
INSERT INTO cc_report(tenant_id, community_id, publish_id, user_id, report_type, description, create_time)
|
||||
VALUES (#{publishReport.tenantId}, #{publishReport.communityId}, #{publishReport.publishId},
|
||||
#{publishReport.userId}, #{publishReport.reportType}, #{publishReport.content})
|
||||
#{publishReport.userId}, #{publishReport.reportType}, #{publishReport.description}, NOW())
|
||||
</insert>
|
||||
<update id="updateStatus">
|
||||
UPDATE cc_report
|
||||
SET status = #{editPublishReportStatusRes.status}
|
||||
WHERE tenant_id = #{editPublishReportStatusRes.tenantId}
|
||||
AND community_id = #{editPublishReportStatusRes.communityId}
|
||||
AND publish_id = #{editPublishReportStatusRes.publishId}
|
||||
</update>
|
||||
<update id="deleteReportById">
|
||||
UPDATE cc_report
|
||||
SET del_flag = '2'
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
Loading…
Reference in New Issue