Merge branch 'feature/admin' into preview
commit
0e2c6e6e7d
|
@ -67,15 +67,18 @@ public class ReportController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改状态
|
* 修改举报状态
|
||||||
* @param id
|
* @param productId
|
||||||
|
* @param type
|
||||||
|
* @param status
|
||||||
|
* @param text
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "修改状态")
|
@ApiOperation(value = "修改状态")
|
||||||
@GetMapping("/updateStatus")
|
@GetMapping("/updateStatus")
|
||||||
public R<Object> updateStatus(@RequestParam Long id){
|
public R<Object> updateStatus(@RequestParam Long productId,Integer type,Integer status,String text){
|
||||||
|
|
||||||
reportService.updateStatus(id);
|
reportService.updateStatus(productId, type,status,text);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -66,4 +66,9 @@ public class DictConstants {
|
||||||
*/
|
*/
|
||||||
public static final String MODEL_TYPE = "model_type";
|
public static final String MODEL_TYPE = "model_type";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 举报类型
|
||||||
|
*/
|
||||||
|
public static final String REPORT_LABEL = "report_label";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.mcwl.resource.domain;
|
package com.mcwl.resource.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
|
@ -83,4 +84,24 @@ public class Report {
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "逻辑删除(0展示 2删除)")
|
@ApiModelProperty(value = "逻辑删除(0展示 2删除)")
|
||||||
private Integer delFlag = 0;
|
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.mcwl.resource.mapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.mcwl.resource.domain.Report;
|
import com.mcwl.resource.domain.Report;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author DaiZibo
|
* @author DaiZibo
|
||||||
|
@ -12,4 +13,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ReportMapper extends BaseMapper<Report> {
|
public interface ReportMapper extends BaseMapper<Report> {
|
||||||
|
void updateStatus(@Param("productId") Long productId, @Param("type") Integer type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.mcwl.resource.service;
|
package com.mcwl.resource.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.common.core.domain.R;
|
||||||
import com.mcwl.resource.domain.Report;
|
import com.mcwl.resource.domain.Report;
|
||||||
import com.mcwl.resource.domain.vo.PageVo;
|
import com.mcwl.resource.domain.vo.PageVo;
|
||||||
|
@ -21,6 +20,6 @@ public interface ReportService {
|
||||||
|
|
||||||
void deleteReport(Long id);
|
void deleteReport(Long id);
|
||||||
|
|
||||||
void updateStatus(Long id);
|
void updateStatus(Long productId,Integer type,Integer status,String text);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,19 @@ package com.mcwl.resource.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.core.domain.R;
|
||||||
import com.mcwl.common.utils.SecurityUtils;
|
import com.mcwl.common.utils.SecurityUtils;
|
||||||
|
import com.mcwl.resource.domain.ModelProduct;
|
||||||
import com.mcwl.resource.domain.Report;
|
import com.mcwl.resource.domain.Report;
|
||||||
|
import com.mcwl.resource.domain.WorkFlow;
|
||||||
import com.mcwl.resource.domain.vo.PageVo;
|
import com.mcwl.resource.domain.vo.PageVo;
|
||||||
|
import com.mcwl.resource.mapper.ModelMapper;
|
||||||
import com.mcwl.resource.mapper.ReportMapper;
|
import com.mcwl.resource.mapper.ReportMapper;
|
||||||
|
import com.mcwl.resource.mapper.WorkFlowMapper;
|
||||||
import com.mcwl.resource.service.ReportService;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -29,6 +35,16 @@ public class ReportServiceImpl implements ReportService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ReportMapper reportMapper;
|
private ReportMapper reportMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysUserMapper sysUserMapper;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WorkFlowMapper workFlowMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ModelMapper modelMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addReport(Report report) {
|
public void addReport(Report report) {
|
||||||
|
|
||||||
|
@ -40,6 +56,7 @@ public class ReportServiceImpl implements ReportService {
|
||||||
@Override
|
@Override
|
||||||
public R<Page<Report>> selectReport(PageVo pageVo) {
|
public R<Page<Report>> selectReport(PageVo pageVo) {
|
||||||
|
|
||||||
|
|
||||||
Page<Report> page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize());
|
Page<Report> page = new Page<>(pageVo.getPageNumber(), pageVo.getPageSize());
|
||||||
|
|
||||||
//构造查询条件
|
//构造查询条件
|
||||||
|
@ -49,7 +66,14 @@ public class ReportServiceImpl implements ReportService {
|
||||||
reportLambdaQueryWrapper.eq(Report::getStatus, 0);
|
reportLambdaQueryWrapper.eq(Report::getStatus, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return R.ok(reportMapper.selectPage(page, reportLambdaQueryWrapper));
|
Page<Report> 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
|
@Override
|
||||||
|
@ -62,12 +86,28 @@ public class ReportServiceImpl implements ReportService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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)
|
reportMapper.updateStatus(productId,type);
|
||||||
.build();
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?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="com.mcwl.resource.mapper.ReportMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<update id="updateStatus">
|
||||||
|
UPDATE report
|
||||||
|
SET status = 0
|
||||||
|
WHERE product_id = #{productId} and type = #{type}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue