111
This commit is contained in:
parent
2d54c21bb7
commit
96d4d77b10
@ -61,6 +61,19 @@ public class BaseCategoryController extends BaseController {
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分类树
|
||||
*
|
||||
* @param code 分类编码
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
* @author PQZ
|
||||
* @date 10:49 2025/4/14
|
||||
**/
|
||||
@GetMapping("/treeData")
|
||||
public AjaxResult treeData(@RequestParam("code") String code) {
|
||||
return success(baseCategoryService.treeData(code));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出分类树-各种分类属性结构列表
|
||||
*/
|
||||
|
@ -1,21 +1,23 @@
|
||||
package com.ruoyi.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.base.domain.BaseCategory;
|
||||
import com.ruoyi.base.vo.BaseCategoryVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 分类树-各种分类属性结构Mapper接口
|
||||
*
|
||||
*
|
||||
* @author vinjor-m
|
||||
* @date 2025-03-17
|
||||
*/
|
||||
@Mapper
|
||||
public interface BaseCategoryMapper extends BaseMapper<BaseCategory>
|
||||
{
|
||||
public interface BaseCategoryMapper extends BaseMapper<BaseCategory> {
|
||||
IPage<BaseCategory> queryListPage(@Param("entity") BaseCategory entity, Page<BaseCategory> page);
|
||||
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.base.domain.BaseCategory;
|
||||
import com.ruoyi.base.vo.BaseCategoryVO;
|
||||
import com.ruoyi.member.vo.MemberUniVO;
|
||||
|
||||
/**
|
||||
@ -48,4 +49,13 @@ public interface IBaseCategoryService extends IService<BaseCategory> {
|
||||
* @date 14:43 2025/4/3
|
||||
**/
|
||||
List<MemberUniVO> uniListByParentCode(String code, Integer isSystem);
|
||||
|
||||
/**
|
||||
* 通用查询分类树方法
|
||||
* @author PQZ
|
||||
* @date 10:50 2025/4/14
|
||||
* @param code 分类code
|
||||
* @return java.util.List<com.ruoyi.base.vo.BaseCategoryVO>
|
||||
**/
|
||||
List<BaseCategoryVO> treeData(String code);
|
||||
}
|
||||
|
@ -1,9 +1,16 @@
|
||||
package com.ruoyi.base.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.base.domain.BaseCity;
|
||||
import com.ruoyi.base.vo.BaseCategoryVO;
|
||||
import com.ruoyi.base.vo.BaseCityVO;
|
||||
import com.ruoyi.common.core.domain.DlBaseEntity;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -84,4 +91,58 @@ public class BaseCategoryServiceImpl extends ServiceImpl<BaseCategoryMapper,Base
|
||||
List<BaseCategory> list = listByParentCode(code, isSystem);
|
||||
return list.stream().map(item -> new MemberUniVO(item.getCode(),item.getTitle())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用查询分类树方法
|
||||
*
|
||||
* @param code 分类code
|
||||
* @return java.util.List<com.ruoyi.base.vo.BaseCategoryVO>
|
||||
* @author PQZ
|
||||
* @date 10:50 2025/4/14
|
||||
**/
|
||||
@Override
|
||||
public List<BaseCategoryVO> treeData(String code) {
|
||||
LambdaQueryWrapper<BaseCategory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(DlBaseEntity::getDelFlag,0);
|
||||
List<BaseCategory> list = list(lambdaQueryWrapper);
|
||||
List<BaseCategoryVO> treeData = buildCategoryTree(list);
|
||||
List<BaseCategoryVO> result = treeData.stream()
|
||||
.filter(node -> code.equals(node.getValue()))
|
||||
.findFirst()
|
||||
.map(BaseCategoryVO::getChildren)
|
||||
.orElseGet(ArrayList::new);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 生成树结构
|
||||
*
|
||||
* @param list List<BaseCity>
|
||||
* @return java.util.List<com.ruoyi.base.vo.BaseCityVO>
|
||||
* @author PQZ
|
||||
* @date 9:44 2025/4/3
|
||||
**/
|
||||
private List<BaseCategoryVO> buildCategoryTree(List<BaseCategory> list) {
|
||||
List<BaseCategoryVO> tree = new ArrayList<>();
|
||||
//创建一个Map来存储每个分类及子集
|
||||
Map<String, BaseCategoryVO> categoryMap = new HashMap<>();
|
||||
for (BaseCategory category : list) {
|
||||
categoryMap.put(category.getId(), new BaseCategoryVO(category.getCode(), category.getTitle()));
|
||||
}
|
||||
//组装类型VO列表
|
||||
for (BaseCategory category : list) {
|
||||
BaseCategoryVO categoryVO = categoryMap.get(category.getId());
|
||||
if ("0".equals(category.getPid())) {
|
||||
//跟类型添加到列表
|
||||
tree.add(categoryVO);
|
||||
} else {
|
||||
//非根类型添加到其父亲的孩子中
|
||||
BaseCategoryVO parentCategoryVO = categoryMap.get(category.getPid());
|
||||
if (parentCategoryVO != null) {
|
||||
parentCategoryVO.getChildren().add(categoryVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.ruoyi.base.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class BaseCategoryVO {
|
||||
String text;
|
||||
String value;
|
||||
List<BaseCategoryVO> children;
|
||||
|
||||
public BaseCategoryVO(String value, String text) {
|
||||
this.text = text;
|
||||
this.value = value;
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
}
|
@ -45,7 +45,6 @@ public class BusiFeedbackController extends BaseController
|
||||
/**
|
||||
* 查询意见反馈列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('busi:feedback:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(BusiFeedbackQuery busiFeedback,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@ -79,6 +78,22 @@ public class BusiFeedbackController extends BaseController
|
||||
return success(busiFeedbackService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增意见反馈
|
||||
*
|
||||
* @param busiFeedback {@link BusiFeedback}
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
* @author PQZ
|
||||
* @date 14:34 2025/4/14
|
||||
**/
|
||||
@PostMapping("/uniAddFeedBack")
|
||||
public AjaxResult uniAddFeedback(@RequestBody BusiFeedback busiFeedback) {
|
||||
busiFeedbackService.uniAddFeedBack(busiFeedback);
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增意见反馈
|
||||
*/
|
||||
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.busi.query.BusiReportQuery;
|
||||
@ -36,8 +37,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/busi/report")
|
||||
public class BusiReportController extends BaseController
|
||||
{
|
||||
public class BusiReportController extends BaseController {
|
||||
@Autowired
|
||||
private IBusiReportService busiReportService;
|
||||
|
||||
@ -48,10 +48,9 @@ public class BusiReportController extends BaseController
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(BusiReportQuery busiReport,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
|
||||
{
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
Page<BusiReportVo> page = new Page<>(pageNum, pageSize);
|
||||
IPage<BusiReportVo> list = busiReportService.queryListPage(busiReport,page);
|
||||
IPage<BusiReportVo> list = busiReportService.queryListPage(busiReport, page);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
@ -61,8 +60,7 @@ public class BusiReportController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('busi:report:export')")
|
||||
@Log(title = "举报记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BusiReport busiReport)
|
||||
{
|
||||
public void export(HttpServletResponse response, BusiReport busiReport) {
|
||||
List<BusiReport> list = busiReportService.list();
|
||||
ExcelUtil<BusiReport> util = new ExcelUtil<BusiReport>(BusiReport.class);
|
||||
util.exportExcel(response, list, "举报记录数据");
|
||||
@ -73,19 +71,34 @@ public class BusiReportController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('busi:report:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") String id) {
|
||||
return success(busiReportService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 博主举报通告主
|
||||
*
|
||||
* @param busiReport {@link BusiReport}
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
* @author PQZ
|
||||
* @date 14:07 2025/4/14
|
||||
**/
|
||||
@Log(title = "博主举报通告主", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/saveReport")
|
||||
public AjaxResult saveReport(@RequestBody BusiReport busiReport) {
|
||||
busiReportService.saveReport(busiReport);
|
||||
return success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增举报记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('busi:report:add')")
|
||||
@Log(title = "举报记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BusiReport busiReport)
|
||||
{
|
||||
public AjaxResult add(@RequestBody BusiReport busiReport) {
|
||||
return toAjax(busiReportService.save(busiReport));
|
||||
}
|
||||
|
||||
@ -94,8 +107,7 @@ public class BusiReportController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('busi:report:edit')")
|
||||
@PostMapping("/dealReport")
|
||||
public AjaxResult dealReport(@RequestBody BusiReport busiReport)
|
||||
{
|
||||
public AjaxResult dealReport(@RequestBody BusiReport busiReport) {
|
||||
busiReportService.dealReport(busiReport);
|
||||
return success();
|
||||
}
|
||||
@ -106,8 +118,7 @@ public class BusiReportController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('busi:report:edit')")
|
||||
@Log(title = "举报记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BusiReport busiReport)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody BusiReport busiReport) {
|
||||
return toAjax(busiReportService.updateById(busiReport));
|
||||
}
|
||||
|
||||
@ -116,9 +127,8 @@ public class BusiReportController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('busi:report:remove')")
|
||||
@Log(title = "举报记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids) {
|
||||
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
||||
return toAjax(busiReportService.removeByIds(list));
|
||||
}
|
||||
|
@ -8,4 +8,6 @@ public class BusiFeedbackQuery {
|
||||
private String userNickName;
|
||||
//反馈人姓名
|
||||
private String backUserNickName;
|
||||
//用户id
|
||||
private Long userId;
|
||||
}
|
||||
|
@ -19,4 +19,12 @@ public interface IBusiFeedbackService extends IService<BusiFeedback>
|
||||
IPage<BusiFeedbackVo> queryListPage(BusiFeedbackQuery pageReqVO, Page<BusiFeedbackVo> page);
|
||||
|
||||
void dealFeedback(BusiFeedback busiFeedback);
|
||||
|
||||
/**
|
||||
* 新增意见反馈
|
||||
* @author PQZ
|
||||
* @date 14:35 2025/4/14
|
||||
* @param busiFeedback {@link BusiFeedback}
|
||||
**/
|
||||
void uniAddFeedBack(BusiFeedback busiFeedback);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.ruoyi.busi.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@ -14,8 +15,18 @@ import com.ruoyi.busi.vo.BusiReportVo;
|
||||
* @author 朱春云
|
||||
* @date 2025-03-17
|
||||
*/
|
||||
public interface IBusiReportService extends IService<BusiReport>
|
||||
{
|
||||
public interface IBusiReportService extends IService<BusiReport> {
|
||||
IPage<BusiReportVo> queryListPage(BusiReportQuery pageReqVO, Page<BusiReportVo> page);
|
||||
|
||||
void dealReport(BusiReport busiReport);
|
||||
|
||||
/**
|
||||
* 博主举报通告主
|
||||
*
|
||||
* @param report {@link BusiReport}
|
||||
* @return void
|
||||
* @author PQZ
|
||||
* @date 14:00 2025/4/14
|
||||
**/
|
||||
void saveReport(BusiReport report);
|
||||
}
|
||||
|
@ -42,4 +42,18 @@ public class BusiFeedbackServiceImpl extends ServiceImpl<BusiFeedbackMapper,Busi
|
||||
busiFeedback.setBackUserId(SecurityUtils.getUserId());
|
||||
busiFeedbackMapper.updateById(busiFeedback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增意见反馈
|
||||
*
|
||||
* @param busiFeedback {@link BusiFeedback}
|
||||
* @author PQZ
|
||||
* @date 14:35 2025/4/14
|
||||
**/
|
||||
@Override
|
||||
public void uniAddFeedBack(BusiFeedback busiFeedback) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
busiFeedback.setUserId(userId);
|
||||
save(busiFeedback);
|
||||
}
|
||||
}
|
||||
|
@ -3,17 +3,23 @@ package com.ruoyi.busi.service.impl;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.busi.query.BusiReportQuery;
|
||||
import com.ruoyi.busi.service.IBusiUserLoveService;
|
||||
import com.ruoyi.busi.vo.BusiReportVo;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.member.domain.MemberBlacklist;
|
||||
import com.ruoyi.member.service.IMemberBlacklistService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.busi.mapper.BusiReportMapper;
|
||||
import com.ruoyi.busi.domain.BusiReport;
|
||||
import com.ruoyi.busi.service.IBusiReportService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 举报记录Service业务层处理
|
||||
@ -26,6 +32,10 @@ public class BusiReportServiceImpl extends ServiceImpl<BusiReportMapper,BusiRepo
|
||||
{
|
||||
@Autowired
|
||||
private BusiReportMapper busiReportMapper;
|
||||
@Resource
|
||||
private IMemberBlacklistService blacklistService;
|
||||
@Resource
|
||||
private IBusiUserLoveService userLoveService;
|
||||
|
||||
@Override
|
||||
public IPage<BusiReportVo> queryListPage(BusiReportQuery pageReqVO, Page<BusiReportVo> page) {
|
||||
@ -42,4 +52,28 @@ public class BusiReportServiceImpl extends ServiceImpl<BusiReportMapper,BusiRepo
|
||||
busiReport.setDealUserId(SecurityUtils.getUserId());
|
||||
busiReportMapper.updateById(busiReport);
|
||||
}
|
||||
|
||||
/**
|
||||
* 博主举报通告主
|
||||
*
|
||||
* @param report {@link BusiReport}
|
||||
* @author PQZ
|
||||
* @date 14:00 2025/4/14
|
||||
**/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveReport(BusiReport report) {
|
||||
//获取当前登录用户
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
report.setUserId(userId);
|
||||
//加入拉黑
|
||||
MemberBlacklist blacklist = new MemberBlacklist();
|
||||
blacklist.setUserId(userId);
|
||||
blacklist.setBlackUserId(report.getReportUserId());
|
||||
blacklist.setBlackUserType(report.getReportUserType());
|
||||
blacklistService.save(blacklist);
|
||||
//取消关注
|
||||
userLoveService.userLoveIs(report.getReportUserId(), "0");
|
||||
save(report);
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
left join sys_user su2 on main.back_user_id = su2.user_id
|
||||
<where>
|
||||
main.del_flag = '0'
|
||||
<if test="entity.userId != null and entity.userId != '' ">
|
||||
and main.user_id = #{entity.userId}
|
||||
</if>
|
||||
<if test="entity.userNickName != null and entity.userNickName != '' ">
|
||||
and su1.nick_name like concat('%', #{entity.userNickName}, '%')
|
||||
</if>
|
||||
|
Loading…
Reference in New Issue
Block a user