diff --git a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java index 60a645a..7840eca 100644 --- a/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java +++ b/mcwl-admin/src/main/java/com/mcwl/web/controller/resource/ReportController.java @@ -67,15 +67,18 @@ public class ReportController { } /** - * 修改状态 - * @param id + * 修改举报状态 + * @param productId + * @param type + * @param status + * @param text * @return */ @ApiOperation(value = "修改状态") @GetMapping("/updateStatus") - public R updateStatus(@RequestParam Long id){ + public R updateStatus(@RequestParam Long productId,Integer type,Integer status,String text){ - reportService.updateStatus(id); + reportService.updateStatus(productId, type,status,text); return R.ok(); } diff --git a/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java b/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java index a10291b..3c30a25 100644 --- a/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java +++ b/mcwl-common/src/main/java/com/mcwl/common/constant/DictConstants.java @@ -66,4 +66,9 @@ public class DictConstants { */ public static final String MODEL_TYPE = "model_type"; + + /** + * 举报类型 + */ + public static final String REPORT_LABEL = "report_label"; } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/domain/Report.java b/mcwl-resource/src/main/java/com/mcwl/resource/domain/Report.java index 33ba937..cac212f 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/domain/Report.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/domain/Report.java @@ -1,5 +1,6 @@ package com.mcwl.resource.domain; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; @@ -83,4 +84,24 @@ public class Report { */ @ApiModelProperty(value = "逻辑删除(0展示 2删除)") private Integer delFlag = 0; + + /** + * 标题 + */ + @ApiModelProperty(value = "标题") + private String productName; + + /** + * 翻译后的举报类型 + */ + @TableField(exist = false) + @ApiModelProperty(value = "翻译后的举报类型") + private String translateType; + + /** + * 举报人 + */ + @TableField(exist = false) + @ApiModelProperty(value = "举报人") + private String nickName; } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ReportMapper.java b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ReportMapper.java index a0badf3..b9df916 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ReportMapper.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/mapper/ReportMapper.java @@ -3,6 +3,7 @@ package com.mcwl.resource.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.mcwl.resource.domain.Report; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * @author DaiZibo @@ -12,4 +13,5 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ReportMapper extends BaseMapper { + void updateStatus(@Param("productId") Long productId, @Param("type") Integer type); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java index 7d6478b..844c7ec 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/ReportService.java @@ -1,7 +1,6 @@ package com.mcwl.resource.service; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.mcwl.common.core.domain.AjaxResult; import com.mcwl.common.core.domain.R; import com.mcwl.resource.domain.Report; import com.mcwl.resource.domain.vo.PageVo; @@ -21,6 +20,6 @@ public interface ReportService { void deleteReport(Long id); - void updateStatus(Long id); + void updateStatus(Long productId,Integer type,Integer status,String text); } diff --git a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java index 4103aba..cc65666 100644 --- a/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java +++ b/mcwl-resource/src/main/java/com/mcwl/resource/service/impl/ReportServiceImpl.java @@ -2,13 +2,19 @@ package com.mcwl.resource.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.mcwl.common.core.domain.AjaxResult; +import com.mcwl.common.constant.DictConstants; import com.mcwl.common.core.domain.R; import com.mcwl.common.utils.SecurityUtils; +import com.mcwl.resource.domain.ModelProduct; import com.mcwl.resource.domain.Report; +import com.mcwl.resource.domain.WorkFlow; import com.mcwl.resource.domain.vo.PageVo; +import com.mcwl.resource.mapper.ModelMapper; import com.mcwl.resource.mapper.ReportMapper; +import com.mcwl.resource.mapper.WorkFlowMapper; import com.mcwl.resource.service.ReportService; +import com.mcwl.system.init.DictInit; +import com.mcwl.system.mapper.SysUserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -29,6 +35,16 @@ public class ReportServiceImpl implements ReportService { @Autowired private ReportMapper reportMapper; + @Autowired + private SysUserMapper sysUserMapper; + + + @Autowired + private WorkFlowMapper workFlowMapper; + + @Autowired + private ModelMapper modelMapper; + @Override public void addReport(Report report) { @@ -40,6 +56,7 @@ public class ReportServiceImpl implements ReportService { @Override public R> selectReport(PageVo pageVo) { + Page page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize()); //构造查询条件 @@ -49,7 +66,14 @@ public class ReportServiceImpl implements ReportService { reportLambdaQueryWrapper.eq(Report::getStatus, 0); } - return R.ok(reportMapper.selectPage(page, reportLambdaQueryWrapper)); + Page reportPage = reportMapper.selectPage(page, reportLambdaQueryWrapper); + + for (Report record : reportPage.getRecords()) { + record.setNickName(sysUserMapper.selectUserById(record.getUserId()).getNickName()); + //翻译举报类型 + record.setTranslateType(DictInit.getDictValue(DictConstants.REPORT_LABEL,record.getReportType()+"")); + } + return R.ok(reportPage); } @Override @@ -62,12 +86,28 @@ public class ReportServiceImpl implements ReportService { } @Override - public void updateStatus(Long id) { + public void updateStatus(Long productId,Integer type,Integer status,String text) { - Report report = new Report().builder().id(id) - .status(1) - .build(); + //修改所有同类举报申请 + reportMapper.updateStatus(productId,type); + if (status == 2){ - reportMapper.updateById(report); + //修改状态回退 + if (type == 0){ + //模型 + ModelProduct modelProduct = ModelProduct.builder().id(productId) + .auditStatus(status) + .auditText(text) + .build(); + modelMapper.updateById(modelProduct); + }else { + //工作流 + WorkFlow workFlow = WorkFlow.builder().id(productId) + .auditStatus(status) + .auditText(text) + .build(); + workFlowMapper.updateById(workFlow); + } + } } } diff --git a/mcwl-resource/src/main/resources/mapper/resource/ReportMapper.xml b/mcwl-resource/src/main/resources/mapper/resource/ReportMapper.xml new file mode 100644 index 0000000..6432af8 --- /dev/null +++ b/mcwl-resource/src/main/resources/mapper/resource/ReportMapper.xml @@ -0,0 +1,15 @@ + + + + + + + UPDATE report + SET status = 0 + WHERE product_id = #{productId} and type = #{type} + + + +