mirror of https://github.com/jeecgboot/jeecg-boot
新功能,表单右侧的留言、历史、附件区域功能
parent
f6fc896982
commit
9dc50c1418
|
@ -0,0 +1,263 @@
|
|||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.dto.DataLogDTO;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.jeecg.modules.system.entity.SysComment;
|
||||
import org.jeecg.modules.system.service.ISysCommentService;
|
||||
import org.jeecg.modules.system.vo.SysCommentFileVo;
|
||||
import org.jeecg.modules.system.vo.SysCommentVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 系统评论回复表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "系统评论回复表")
|
||||
@RestController
|
||||
@RequestMapping("/sys/comment")
|
||||
@Slf4j
|
||||
public class SysCommentController extends JeecgController<SysComment, ISysCommentService> {
|
||||
|
||||
@Autowired
|
||||
private ISysCommentService sysCommentService;
|
||||
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
|
||||
|
||||
/**
|
||||
* 在线预览文件地址
|
||||
*/
|
||||
@Value("${jeecg.file-view-domain}/onlinePreview")
|
||||
private String onlinePreviewDomain;
|
||||
|
||||
/**
|
||||
* 查询评论+文件
|
||||
*
|
||||
* @param sysComment
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统评论回复表-列表查询", notes = "系统评论回复表-列表查询")
|
||||
@GetMapping(value = "/listByForm")
|
||||
public Result<IPage<SysCommentVO>> queryListByForm(SysComment sysComment) {
|
||||
List<SysCommentVO> list = sysCommentService.queryFormCommentInfo(sysComment);
|
||||
IPage<SysCommentVO> pageList = new Page();
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件
|
||||
*
|
||||
* @param sysComment
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统评论回复表-列表查询", notes = "系统评论回复表-列表查询")
|
||||
@GetMapping(value = "/fileList")
|
||||
public Result<IPage<SysCommentFileVo>> queryFileList(SysComment sysComment) {
|
||||
List<SysCommentFileVo> list = sysCommentService.queryFormFileList(sysComment.getTableName(), sysComment.getTableDataId());
|
||||
IPage<SysCommentFileVo> pageList = new Page();
|
||||
pageList.setRecords(list);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "系统评论表-添加文本", notes = "系统评论表-添加文本")
|
||||
@PostMapping(value = "/addText")
|
||||
public Result<String> addText(@RequestBody SysComment sysComment) {
|
||||
String commentId = sysCommentService.saveOne(sysComment);
|
||||
return Result.OK(commentId);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "系统评论表-添加文件", notes = "系统评论表-添加文件")
|
||||
@PostMapping(value = "/addFile")
|
||||
public Result<String> addFile(HttpServletRequest request) {
|
||||
try {
|
||||
sysCommentService.saveOneFileComment(request);
|
||||
return Result.OK("success");
|
||||
} catch (Exception e) {
|
||||
log.error("评论文件上传失败", e.getMessage());
|
||||
return Result.error("操作失败," + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "系统评论回复表-通过id删除", notes = "系统评论回复表-通过id删除")
|
||||
@DeleteMapping(value = "/deleteOne")
|
||||
public Result<String> deleteOne(@RequestParam(name = "id", required = true) String id) {
|
||||
SysComment comment = sysCommentService.getById(id);
|
||||
if(comment==null){
|
||||
return Result.error("该评论已被删除!");
|
||||
}
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String username = sysUser.getUsername();
|
||||
String admin = "admin";
|
||||
//除了admin外 其他人只能删除自己的评论
|
||||
if((!admin.equals(username)) && !username.equals(comment.getCreateBy())){
|
||||
return Result.error("只能删除自己的评论!");
|
||||
}
|
||||
sysCommentService.deleteOne(id);
|
||||
//删除评论添加日志
|
||||
String logContent = "删除了评论, "+ comment.getCommentContent();
|
||||
DataLogDTO dataLog = new DataLogDTO(comment.getTableName(), comment.getTableDataId(), logContent, CommonConstant.DATA_LOG_TYPE_COMMENT);
|
||||
sysBaseAPI.saveDataLog(dataLog);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取文件预览的地址
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getFileViewDomain")
|
||||
public Result<String> getFileViewDomain() {
|
||||
return Result.OK(onlinePreviewDomain);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysComment
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
////@AutoLog(value = "系统评论回复表-分页列表查询")
|
||||
@ApiOperation(value = "系统评论回复表-分页列表查询", notes = "系统评论回复表-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<IPage<SysComment>> queryPageList(SysComment sysComment,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysComment> queryWrapper = QueryGenerator.initQueryWrapper(sysComment, req.getParameterMap());
|
||||
Page<SysComment> page = new Page<SysComment>(pageNo, pageSize);
|
||||
IPage<SysComment> pageList = sysCommentService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysComment
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "系统评论回复表-添加", notes = "系统评论回复表-添加")
|
||||
//@RequiresPermissions("org.jeecg.modules.demo:sys_comment:add")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<String> add(@RequestBody SysComment sysComment) {
|
||||
sysCommentService.save(sysComment);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysComment
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "系统评论回复表-编辑")
|
||||
@ApiOperation(value = "系统评论回复表-编辑", notes = "系统评论回复表-编辑")
|
||||
//@RequiresPermissions("org.jeecg.modules.demo:sys_comment:edit")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<String> edit(@RequestBody SysComment sysComment) {
|
||||
sysCommentService.updateById(sysComment);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "系统评论回复表-通过id删除")
|
||||
@ApiOperation(value = "系统评论回复表-通过id删除", notes = "系统评论回复表-通过id删除")
|
||||
//@RequiresPermissions("org.jeecg.modules.demo:sys_comment:delete")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sysCommentService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
//@AutoLog(value = "系统评论回复表-批量删除")
|
||||
@ApiOperation(value = "系统评论回复表-批量删除", notes = "系统评论回复表-批量删除")
|
||||
//@RequiresPermissions("org.jeecg.modules.demo:sys_comment:deleteBatch")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sysCommentService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
////@AutoLog(value = "系统评论回复表-通过id查询")
|
||||
@ApiOperation(value = "系统评论回复表-通过id查询", notes = "系统评论回复表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<SysComment> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysComment sysComment = sysCommentService.getById(id);
|
||||
if (sysComment == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sysComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sysComment
|
||||
*/
|
||||
//@RequiresPermissions("org.jeecg.modules.demo:sys_comment:exportXls")
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysComment sysComment) {
|
||||
return super.exportXls(request, sysComment, SysComment.class, "系统评论回复表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
//@RequiresPermissions("sys_comment:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysComment.class);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.system.entity.SysFiles;
|
||||
import org.jeecg.modules.system.service.ISysFilesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Description: 知识库-文档管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "知识库-文档管理")
|
||||
@RestController
|
||||
@RequestMapping("/sys/files")
|
||||
public class SysFilesController extends JeecgController<SysFiles, ISysFilesService> {
|
||||
@Autowired
|
||||
private ISysFilesService sysFilesService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysFiles
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "知识库-文档管理-分页列表查询")
|
||||
@ApiOperation(value = "知识库-文档管理-分页列表查询", notes = "知识库-文档管理-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<?> queryPageList(SysFiles sysFiles,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysFiles> queryWrapper = QueryGenerator.initQueryWrapper(sysFiles, req.getParameterMap());
|
||||
Page<SysFiles> page = new Page<SysFiles>(pageNo, pageSize);
|
||||
IPage<SysFiles> pageList = sysFilesService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysFiles
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "知识库-文档管理-添加")
|
||||
@ApiOperation(value = "知识库-文档管理-添加", notes = "知识库-文档管理-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody SysFiles sysFiles) {
|
||||
sysFilesService.save(sysFiles);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysFiles
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "知识库-文档管理-编辑")
|
||||
@ApiOperation(value = "知识库-文档管理-编辑", notes = "知识库-文档管理-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<?> edit(@RequestBody SysFiles sysFiles) {
|
||||
sysFilesService.updateById(sysFiles);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "知识库-文档管理-通过id删除")
|
||||
@ApiOperation(value = "知识库-文档管理-通过id删除", notes = "知识库-文档管理-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sysFilesService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "知识库-文档管理-批量删除")
|
||||
@ApiOperation(value = "知识库-文档管理-批量删除", notes = "知识库-文档管理-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sysFilesService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "知识库-文档管理-通过id查询")
|
||||
@ApiOperation(value = "知识库-文档管理-通过id查询", notes = "知识库-文档管理-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysFiles sysFiles = sysFilesService.getById(id);
|
||||
return Result.OK(sysFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sysFiles
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysFiles sysFiles) {
|
||||
return super.exportXls(request, sysFiles, SysFiles.class, "知识库-文档管理");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysFiles.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,152 @@
|
|||
package org.jeecg.modules.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.aspect.annotation.AutoLog;
|
||||
import org.jeecg.common.system.base.controller.JeecgController;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.modules.system.entity.SysFormFile;
|
||||
import org.jeecg.modules.system.service.ISysFormFileService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @Description: 表单评论文件
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Api(tags = "表单评论文件")
|
||||
@RestController
|
||||
@RequestMapping("/sys/formFile")
|
||||
public class SysFormFileController extends JeecgController<SysFormFile, ISysFormFileService> {
|
||||
@Autowired
|
||||
private ISysFormFileService sysFormFileService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sysFormFile
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单评论文件-分页列表查询")
|
||||
@ApiOperation(value = "表单评论文件-分页列表查询", notes = "表单评论文件-分页列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<?> queryPageList(SysFormFile sysFormFile,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SysFormFile> queryWrapper = QueryGenerator.initQueryWrapper(sysFormFile, req.getParameterMap());
|
||||
Page<SysFormFile> page = new Page<SysFormFile>(pageNo, pageSize);
|
||||
IPage<SysFormFile> pageList = sysFormFileService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sysFormFile
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单评论文件-添加")
|
||||
@ApiOperation(value = "表单评论文件-添加", notes = "表单评论文件-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@RequestBody SysFormFile sysFormFile) {
|
||||
sysFormFileService.save(sysFormFile);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysFormFile
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单评论文件-编辑")
|
||||
@ApiOperation(value = "表单评论文件-编辑", notes = "表单评论文件-编辑")
|
||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||
public Result<?> edit(@RequestBody SysFormFile sysFormFile) {
|
||||
sysFormFileService.updateById(sysFormFile);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单评论文件-通过id删除")
|
||||
@ApiOperation(value = "表单评论文件-通过id删除", notes = "表单评论文件-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sysFormFileService.removeById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单评论文件-批量删除")
|
||||
@ApiOperation(value = "表单评论文件-批量删除", notes = "表单评论文件-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sysFormFileService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "表单评论文件-通过id查询")
|
||||
@ApiOperation(value = "表单评论文件-通过id查询", notes = "表单评论文件-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SysFormFile sysFormFile = sysFormFileService.getById(id);
|
||||
return Result.OK(sysFormFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sysFormFile
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SysFormFile sysFormFile) {
|
||||
return super.exportXls(request, sysFormFile, SysFormFile.class, "表单评论文件");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SysFormFile.class);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
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 org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 系统评论回复表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_comment")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sys_comment对象", description="系统评论回复表")
|
||||
public class SysComment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
/**表名*/
|
||||
@Excel(name = "表名", width = 15)
|
||||
@ApiModelProperty(value = "表名")
|
||||
private String tableName;
|
||||
/**数据id*/
|
||||
@Excel(name = "数据id", width = 15)
|
||||
@ApiModelProperty(value = "数据id")
|
||||
private String tableDataId;
|
||||
/**来源用户id*/
|
||||
@Excel(name = "来源用户id", width = 15)
|
||||
@ApiModelProperty(value = "来源用户id")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
private String fromUserId;
|
||||
/**发送给用户id(允许为空)*/
|
||||
@Excel(name = "发送给用户id(允许为空)", width = 15)
|
||||
@ApiModelProperty(value = "发送给用户id(允许为空)")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
private String toUserId;
|
||||
/**评论id(允许为空,不为空时,则为回复)*/
|
||||
@Excel(name = "评论id(允许为空,不为空时,则为回复)", width = 15)
|
||||
@ApiModelProperty(value = "评论id(允许为空,不为空时,则为回复)")
|
||||
@Dict(dictTable = "sys_comment", dicCode = "id", dicText = "comment_content")
|
||||
private String commentId;
|
||||
/**回复内容*/
|
||||
@Excel(name = "回复内容", width = 15)
|
||||
@ApiModelProperty(value = "回复内容")
|
||||
private String commentContent;
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
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 org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 知识库-文档管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_files")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="sys_files对象", description="知识库-文档管理")
|
||||
public class SysFiles {
|
||||
|
||||
/**主键id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private String id;
|
||||
/**文件名称*/
|
||||
@Excel(name = "文件名称", width = 15)
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String fileName;
|
||||
/**文件地址*/
|
||||
@Excel(name = "文件地址", width = 15)
|
||||
@ApiModelProperty(value = "文件地址")
|
||||
private String url;
|
||||
/**创建人登录名称*/
|
||||
@Excel(name = "创建人登录名称", width = 15)
|
||||
@ApiModelProperty(value = "创建人登录名称")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
/**更新人登录名称*/
|
||||
@Excel(name = "更新人登录名称", width = 15)
|
||||
@ApiModelProperty(value = "更新人登录名称")
|
||||
private String updateBy;
|
||||
/**更新日期*/
|
||||
@Excel(name = "更新日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
/**文档类型(folder:文件夹 excel:excel doc:word pp:ppt image:图片 archive:其他文档 video:视频)*/
|
||||
@Excel(name = "文档类型(folder:文件夹 excel:excel doc:word pp:ppt image:图片 archive:其他文档 video:视频)", width = 15)
|
||||
@ApiModelProperty(value = "文档类型(folder:文件夹 excel:excel doc:word pp:ppt image:图片 archive:其他文档 video:视频)")
|
||||
private String fileType;
|
||||
/**文件上传类型(temp/本地上传(临时文件) manage/知识库)*/
|
||||
@Excel(name = "文件上传类型(temp/本地上传(临时文件) manage/知识库)", width = 15)
|
||||
@ApiModelProperty(value = "文件上传类型(temp/本地上传(临时文件) manage/知识库)")
|
||||
private String storeType;
|
||||
/**父级id*/
|
||||
@Excel(name = "父级id", width = 15)
|
||||
@ApiModelProperty(value = "父级id")
|
||||
private String parentId;
|
||||
/**租户id*/
|
||||
@Excel(name = "租户id", width = 15)
|
||||
@ApiModelProperty(value = "租户id")
|
||||
private String tenantId;
|
||||
/**文件大小(kb)*/
|
||||
@Excel(name = "文件大小(kb)", width = 15)
|
||||
@ApiModelProperty(value = "文件大小(kb)")
|
||||
private Double fileSize;
|
||||
/**是否文件夹(1:是 0:否)*/
|
||||
@Excel(name = "是否文件夹(1:是 0:否)", width = 15)
|
||||
@ApiModelProperty(value = "是否文件夹(1:是 0:否)")
|
||||
private String izFolder;
|
||||
/**是否为1级文件夹,允许为空 (1:是 )*/
|
||||
@Excel(name = "是否为1级文件夹,允许为空 (1:是 )", width = 15)
|
||||
@ApiModelProperty(value = "是否为1级文件夹,允许为空 (1:是 )")
|
||||
private String izRootFolder;
|
||||
/**是否标星(1:是 0:否)*/
|
||||
@Excel(name = "是否标星(1:是 0:否)", width = 15)
|
||||
@ApiModelProperty(value = "是否标星(1:是 0:否)")
|
||||
private String izStar;
|
||||
/**下载次数*/
|
||||
@Excel(name = "下载次数", width = 15)
|
||||
@ApiModelProperty(value = "下载次数")
|
||||
private Integer downCount;
|
||||
/**阅读次数*/
|
||||
@Excel(name = "阅读次数", width = 15)
|
||||
@ApiModelProperty(value = "阅读次数")
|
||||
private Integer readCount;
|
||||
/**分享链接*/
|
||||
@Excel(name = "分享链接", width = 15)
|
||||
@ApiModelProperty(value = "分享链接")
|
||||
private String shareUrl;
|
||||
/**分享权限(1.关闭分享 2.允许所有联系人查看 3.允许任何人查看)*/
|
||||
@Excel(name = "分享权限(1.关闭分享 2.允许所有联系人查看 3.允许任何人查看)", width = 15)
|
||||
@ApiModelProperty(value = "分享权限(1.关闭分享 2.允许所有联系人查看 3.允许任何人查看)")
|
||||
private String sharePerms;
|
||||
/**是否允许下载(1:是 0:否)*/
|
||||
@Excel(name = "是否允许下载(1:是 0:否)", width = 15)
|
||||
@ApiModelProperty(value = "是否允许下载(1:是 0:否)")
|
||||
private String enableDown;
|
||||
/**是否允许修改(1:是 0:否)*/
|
||||
@Excel(name = "是否允许修改(1:是 0:否)", width = 15)
|
||||
@ApiModelProperty(value = "是否允许修改(1:是 0:否)")
|
||||
private String enableUpdat;
|
||||
/**删除状态(0-正常,1-删除至回收站)*/
|
||||
@Excel(name = "删除状态(0-正常,1-删除至回收站)", width = 15)
|
||||
@ApiModelProperty(value = "删除状态(0-正常,1-删除至回收站)")
|
||||
private String delFlag;
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package org.jeecg.modules.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
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 org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: 表单评论文件
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sys_form_file")
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="sys_form_file对象", description="表单评论文件")
|
||||
public class SysFormFile {
|
||||
|
||||
/**id*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
/**表名*/
|
||||
@Excel(name = "表名", width = 15)
|
||||
@ApiModelProperty(value = "表名")
|
||||
private String tableName;
|
||||
/**数据id*/
|
||||
@Excel(name = "数据id", width = 15)
|
||||
@ApiModelProperty(value = "数据id")
|
||||
private String tableDataId;
|
||||
/**关联文件id*/
|
||||
@Excel(name = "关联文件id", width = 15)
|
||||
@ApiModelProperty(value = "关联文件id")
|
||||
private String fileId;
|
||||
/**文档类型(folder:文件夹 excel:excel doc:word pp:ppt image:图片 archive:其他文档 video:视频)*/
|
||||
@Excel(name = "文档类型(folder:文件夹 excel:excel doc:word pp:ppt image:图片 archive:其他文档 video:视频)", width = 15)
|
||||
@ApiModelProperty(value = "文档类型(folder:文件夹 excel:excel doc:word pp:ppt image:图片 archive:其他文档 video:视频)")
|
||||
private String fileType;
|
||||
/**创建人登录名称*/
|
||||
@Excel(name = "创建人登录名称", width = 15)
|
||||
@ApiModelProperty(value = "创建人登录名称")
|
||||
private String createBy;
|
||||
/**创建日期*/
|
||||
@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.modules.system.entity.SysComment;
|
||||
import org.jeecg.modules.system.vo.SysCommentFileVo;
|
||||
import org.jeecg.modules.system.vo.SysCommentVO;
|
||||
import org.jeecg.modules.system.vo.UserAvatar;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Description: 系统评论回复表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysCommentMapper extends BaseMapper<SysComment> {
|
||||
|
||||
List<SysCommentVO> queryCommentList(@Param("tableName") String tableName, @Param("formDataId") String formDataId);
|
||||
|
||||
/**
|
||||
* 根据表名和数据id查询表单文件
|
||||
*
|
||||
* @param tableName
|
||||
* @param formDataId
|
||||
* @return
|
||||
*/
|
||||
List<SysCommentFileVo> queryFormFileList(@Param("tableName") String tableName, @Param("formDataId") String formDataId);
|
||||
|
||||
/**
|
||||
* 根据用户名获取用户信息
|
||||
* @param idSet
|
||||
* @return
|
||||
*/
|
||||
List<UserAvatar> queryUserAvatarList(@Param("idSet") Set<String> idSet);
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.entity.SysFiles;
|
||||
|
||||
/**
|
||||
* @Description: 知识库-文档管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysFilesMapper extends BaseMapper<SysFiles> {
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.jeecg.modules.system.entity.SysFormFile;
|
||||
|
||||
/**
|
||||
* @Description: 表单评论文件
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SysFormFileMapper extends BaseMapper<SysFormFile> {
|
||||
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
<?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="org.jeecg.modules.system.mapper.SysCommentMapper">
|
||||
|
||||
<resultMap id="commentResult" type="org.jeecg.modules.system.vo.SysCommentVO">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="tableName" column="table_name" jdbcType="VARCHAR"/>
|
||||
<result property="tableDataId" column="table_data_id" jdbcType="VARCHAR"/>
|
||||
<result property="fromUserId" column="from_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="commentContent" column="comment_content" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="toUserId" column="to_user_id" jdbcType="VARCHAR"/>
|
||||
<result property="commentId" column="comment_id" jdbcType="VARCHAR"/>
|
||||
<!-- 8+6 -->
|
||||
<collection property="fileList" ofType="org.jeecg.modules.system.vo.SysCommentFileVo" javaType="java.util.List">
|
||||
<result property="sysFormFileId" column="sys_form_file_id" jdbcType="VARCHAR"/>
|
||||
<result property="fileId" column="file_id" jdbcType="VARCHAR"/>
|
||||
<result property="name" column="file_name" jdbcType="VARCHAR"/>
|
||||
<result property="fileSize" column="file_size" jdbcType="VARCHAR"/>
|
||||
<result property="url" column="url" jdbcType="VARCHAR"/>
|
||||
<result property="type" column="file_type" jdbcType="VARCHAR"/>
|
||||
<result property="storeType" column="store_type" jdbcType="VARCHAR"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<!-- 根据表名和数据id查询表单评论信息及文件 -->
|
||||
<select id="queryCommentList" resultMap="commentResult">
|
||||
select
|
||||
a.id,
|
||||
a.table_name,
|
||||
a.table_data_id,
|
||||
a.from_user_id,
|
||||
a.comment_content,
|
||||
a.create_time,
|
||||
a.to_user_id,
|
||||
a.comment_id,
|
||||
b.id as sys_form_file_id,
|
||||
c.id as file_id,
|
||||
c.file_name,
|
||||
c.file_size,
|
||||
c.url,
|
||||
c.file_type,
|
||||
c.store_type
|
||||
from sys_comment a
|
||||
left join sys_form_file b on b.table_name = 'sys_comment' and b.table_data_id = a.id
|
||||
left join sys_files c on b.file_id = c.id and c.del_flag = '0'
|
||||
where a.table_name = #{tableName, jdbcType=VARCHAR}
|
||||
and a.table_data_id = #{formDataId, jdbcType=VARCHAR}
|
||||
order by a.create_time asc
|
||||
</select>
|
||||
|
||||
<!-- 根据表名和数据id查询表单文件 -->
|
||||
<select id="queryFormFileList" resultType="org.jeecg.modules.system.vo.SysCommentFileVo">
|
||||
select
|
||||
b.id as sys_form_file_id,
|
||||
c.id as file_id,
|
||||
c.file_name as name,
|
||||
c.file_size,
|
||||
c.url,
|
||||
c.file_type as type,
|
||||
c.store_type
|
||||
from sys_comment a
|
||||
join sys_form_file b on b.table_name = 'sys_comment' and b.table_data_id = a.id
|
||||
join sys_files c on b.file_id = c.id
|
||||
where c.del_flag = '0'
|
||||
and a.table_name = #{tableName, jdbcType=VARCHAR}
|
||||
and a.table_data_id = #{formDataId, jdbcType=VARCHAR}
|
||||
order by a.create_time asc
|
||||
</select>
|
||||
|
||||
<!-- 根据用户名获取用户信息 -->
|
||||
<select id="queryUserAvatarList" resultType="org.jeecg.modules.system.vo.UserAvatar">
|
||||
select id, avatar, realname from sys_user
|
||||
WHERE id IN
|
||||
<foreach item="id" collection="idSet" open="(" separator="or" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,60 @@
|
|||
package org.jeecg.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.system.entity.SysComment;
|
||||
import org.jeecg.modules.system.vo.SysCommentFileVo;
|
||||
import org.jeecg.modules.system.vo.SysCommentVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 系统评论回复表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysCommentService extends IService<SysComment> {
|
||||
|
||||
|
||||
/**
|
||||
* 保存评论 返回评论ID
|
||||
*
|
||||
* @param sysComment
|
||||
*/
|
||||
String saveOne(SysComment sysComment);
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteOne(String id);
|
||||
|
||||
/**
|
||||
* 根据表名和数据id查询表单评论及文件信息
|
||||
*
|
||||
* @param sysComment
|
||||
* @return
|
||||
*/
|
||||
List<SysCommentVO> queryFormCommentInfo(SysComment sysComment);
|
||||
|
||||
|
||||
/**
|
||||
* 保存文件+评论
|
||||
*
|
||||
* @param req
|
||||
*/
|
||||
void saveOneFileComment(HttpServletRequest req);
|
||||
|
||||
|
||||
/**
|
||||
* 查询当前表单的文件列表
|
||||
*
|
||||
* @param tableName
|
||||
* @param formDataId
|
||||
* @return
|
||||
*/
|
||||
List<SysCommentFileVo> queryFormFileList(String tableName, String formDataId);
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.system.entity.SysFiles;
|
||||
|
||||
/**
|
||||
* @Description: 知识库-文档管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysFilesService extends IService<SysFiles> {
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.jeecg.modules.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.modules.system.entity.SysFormFile;
|
||||
|
||||
/**
|
||||
* @Description: 表单评论文件
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISysFormFileService extends IService<SysFormFile> {
|
||||
|
||||
}
|
|
@ -0,0 +1,303 @@
|
|||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.jeecg.common.constant.enums.FileTypeEnum;
|
||||
import org.jeecg.common.constant.enums.MessageTypeEnum;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
import org.jeecg.common.util.CommonUtils;
|
||||
import org.jeecg.common.util.RedisUtil;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.modules.system.entity.SysComment;
|
||||
import org.jeecg.modules.system.entity.SysFiles;
|
||||
import org.jeecg.modules.system.entity.SysFormFile;
|
||||
import org.jeecg.modules.system.mapper.SysCommentMapper;
|
||||
import org.jeecg.modules.system.mapper.SysFilesMapper;
|
||||
import org.jeecg.modules.system.mapper.SysFormFileMapper;
|
||||
import org.jeecg.modules.system.service.ISysCommentService;
|
||||
import org.jeecg.modules.system.vo.SysCommentFileVo;
|
||||
import org.jeecg.modules.system.vo.SysCommentVO;
|
||||
import org.jeecg.modules.system.vo.UserAvatar;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @Description: 系统评论回复表
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysCommentServiceImpl extends ServiceImpl<SysCommentMapper, SysComment> implements ISysCommentService {
|
||||
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseApi;
|
||||
|
||||
@Autowired
|
||||
private SysFormFileMapper sysFormFileMapper;
|
||||
|
||||
@Autowired
|
||||
private SysFilesMapper sysFilesMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Value(value = "${jeecg.path.upload}")
|
||||
private String uploadpath;
|
||||
|
||||
@Value(value = "${jeecg.uploadType}")
|
||||
private String uploadType;
|
||||
|
||||
/**
|
||||
* sysFormFile中的表名
|
||||
*/
|
||||
private static final String SYS_FORM_FILE_TABLE_NAME = "sys_comment";
|
||||
|
||||
@Override
|
||||
public List<SysCommentVO> queryFormCommentInfo(SysComment sysComment) {
|
||||
String tableName = sysComment.getTableName();
|
||||
String dataId = sysComment.getTableDataId();
|
||||
//获取评论信息
|
||||
List<SysCommentVO> list = this.baseMapper.queryCommentList(tableName, dataId);
|
||||
// 获取评论相关人员
|
||||
Set<String> personSet = new HashSet<>();
|
||||
if(list!=null && list.size()>0){
|
||||
for(SysCommentVO vo: list){
|
||||
if(oConvertUtils.isNotEmpty(vo.getFromUserId())){
|
||||
personSet.add(vo.getFromUserId());
|
||||
}
|
||||
if(oConvertUtils.isNotEmpty(vo.getToUserId())){
|
||||
personSet.add(vo.getToUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(personSet.size()>0){
|
||||
//获取用户信息
|
||||
Map<String, UserAvatar> userAvatarMap = queryUserAvatar(personSet);
|
||||
for(SysCommentVO vo: list){
|
||||
String formId = vo.getFromUserId();
|
||||
String toId = vo.getToUserId();
|
||||
// 设置头像、用户名
|
||||
if(oConvertUtils.isNotEmpty(formId)){
|
||||
UserAvatar fromUser = userAvatarMap.get(formId);
|
||||
if(fromUser!=null){
|
||||
vo.setFromUserId_dictText(fromUser.getRealname());
|
||||
vo.setFromUserAvatar(fromUser.getAvatar());
|
||||
}
|
||||
}
|
||||
if(oConvertUtils.isNotEmpty(toId)){
|
||||
UserAvatar toUser = userAvatarMap.get(toId);
|
||||
if(toUser!=null){
|
||||
vo.setToUserId_dictText(toUser.getRealname());
|
||||
vo.setToUserAvatar(toUser.getAvatar());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void saveOneFileComment(HttpServletRequest request) {
|
||||
String savePath = "";
|
||||
String bizPath = request.getParameter("biz");
|
||||
//LOWCOD-2580 sys/common/upload接口存在任意文件上传漏洞
|
||||
if (oConvertUtils.isNotEmpty(bizPath)) {
|
||||
if (bizPath.contains(SymbolConstant.SPOT_SINGLE_SLASH) || bizPath.contains(SymbolConstant.SPOT_DOUBLE_BACKSLASH)) {
|
||||
throw new JeecgBootException("上传目录bizPath,格式非法!");
|
||||
}
|
||||
}
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = multipartRequest.getFile("file");
|
||||
if (oConvertUtils.isEmpty(bizPath)) {
|
||||
if (CommonConstant.UPLOAD_TYPE_OSS.equals(uploadType)) {
|
||||
//未指定目录,则用阿里云默认目录 upload
|
||||
bizPath = "upload";
|
||||
} else {
|
||||
bizPath = "";
|
||||
}
|
||||
}
|
||||
if (CommonConstant.UPLOAD_TYPE_LOCAL.equals(uploadType)) {
|
||||
savePath = this.uploadLocal(file, bizPath);
|
||||
} else {
|
||||
savePath = CommonUtils.upload(file, bizPath, uploadType);
|
||||
}
|
||||
|
||||
String orgName = file.getOriginalFilename();
|
||||
// 获取文件名
|
||||
orgName = CommonUtils.getFileName(orgName);
|
||||
//文件大小
|
||||
long size = file.getSize();
|
||||
//文件类型
|
||||
String type = orgName.substring(orgName.lastIndexOf("."), orgName.length());
|
||||
FileTypeEnum fileType = FileTypeEnum.getByType(type);
|
||||
|
||||
//保存至 SysFiles
|
||||
SysFiles sysFiles = new SysFiles();
|
||||
sysFiles.setFileName(orgName);
|
||||
sysFiles.setUrl(savePath);
|
||||
sysFiles.setFileType(fileType.getValue());
|
||||
sysFiles.setStoreType("temp");
|
||||
if (size > 0) {
|
||||
sysFiles.setFileSize(Double.parseDouble(String.valueOf(size)));
|
||||
}
|
||||
String defaultValue = "0";
|
||||
sysFiles.setIzStar(defaultValue);
|
||||
sysFiles.setIzFolder(defaultValue);
|
||||
sysFiles.setIzRootFolder(defaultValue);
|
||||
sysFiles.setDelFlag(defaultValue);
|
||||
String fileId = String.valueOf(IdWorker.getId());
|
||||
sysFiles.setId(fileId);
|
||||
sysFilesMapper.insert(sysFiles);
|
||||
|
||||
//保存至 SysFormFile
|
||||
String tableName = SYS_FORM_FILE_TABLE_NAME;
|
||||
String tableDataId = request.getParameter("commentId");
|
||||
SysFormFile sysFormFile = new SysFormFile();
|
||||
sysFormFile.setTableName(tableName);
|
||||
sysFormFile.setFileType(fileType.getValue());
|
||||
sysFormFile.setTableDataId(tableDataId);
|
||||
sysFormFile.setFileId(fileId);
|
||||
sysFormFileMapper.insert(sysFormFile);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysCommentFileVo> queryFormFileList(String tableName, String formDataId) {
|
||||
List<SysCommentFileVo> list = baseMapper.queryFormFileList(tableName, formDataId);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String saveOne(SysComment sysComment) {
|
||||
this.save(sysComment);
|
||||
//发送系统消息
|
||||
String content = sysComment.getCommentContent();
|
||||
if (content.indexOf("@") >= 0) {
|
||||
Set<String> set = getCommentUsername(content);
|
||||
if (set.size() > 0) {
|
||||
String users = String.join(",", set);
|
||||
MessageDTO md = new MessageDTO();
|
||||
md.setTitle("有人在表单评论中提到了你");
|
||||
md.setContent(content);
|
||||
md.setToAll(false);
|
||||
md.setToUser(users);
|
||||
md.setFromUser("system");
|
||||
md.setType(MessageTypeEnum.XT.getType());
|
||||
sysBaseApi.sendTemplateMessage(md);
|
||||
}
|
||||
}
|
||||
return sysComment.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteOne(String id) {
|
||||
this.removeById(id);
|
||||
//还要删除关联文件
|
||||
LambdaQueryWrapper<SysFormFile> query = new LambdaQueryWrapper<SysFormFile>()
|
||||
.eq(SysFormFile::getTableDataId, id)
|
||||
.eq(SysFormFile::getTableName, SYS_FORM_FILE_TABLE_NAME);
|
||||
this.sysFormFileMapper.delete(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过正则获取评论中的用户账号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private Set<String> getCommentUsername(String content) {
|
||||
Set<String> set = new HashSet<String>(3);
|
||||
String reg = "(@(.*?)\\[(.*?)\\])";
|
||||
Pattern p = Pattern.compile(reg);
|
||||
Matcher m = p.matcher(content);
|
||||
while (m.find()) {
|
||||
if (m.groupCount() == 3) {
|
||||
String username = m.group(3);
|
||||
set.add(username);
|
||||
}
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 本地文件上传
|
||||
*
|
||||
* @param mf 文件
|
||||
* @param bizPath 自定义路径
|
||||
* @return
|
||||
*/
|
||||
private String uploadLocal(MultipartFile mf, String bizPath) {
|
||||
//LOWCOD-2580 sys/common/upload接口存在任意文件上传漏洞
|
||||
if (oConvertUtils.isNotEmpty(bizPath) && (bizPath.contains("../") || bizPath.contains("..\\"))) {
|
||||
throw new JeecgBootException("上传目录bizPath,格式非法!");
|
||||
}
|
||||
try {
|
||||
String ctxPath = uploadpath;
|
||||
String fileName = null;
|
||||
File file = new File(ctxPath + File.separator + bizPath + File.separator);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();// 创建文件根目录
|
||||
}
|
||||
String orgName = mf.getOriginalFilename();// 获取文件名
|
||||
orgName = CommonUtils.getFileName(orgName);
|
||||
if (orgName.indexOf(".") != -1) {
|
||||
fileName = orgName.substring(0, orgName.lastIndexOf(".")) + "_" + System.currentTimeMillis() + orgName.substring(orgName.indexOf("."));
|
||||
} else {
|
||||
fileName = orgName + "_" + System.currentTimeMillis();
|
||||
}
|
||||
String savePath = file.getPath() + File.separator + fileName;
|
||||
File savefile = new File(savePath);
|
||||
FileCopyUtils.copy(mf.getBytes(), savefile);
|
||||
String dbpath = null;
|
||||
if (oConvertUtils.isNotEmpty(bizPath)) {
|
||||
dbpath = bizPath + File.separator + fileName;
|
||||
} else {
|
||||
dbpath = fileName;
|
||||
}
|
||||
if (dbpath.contains("\\")) {
|
||||
dbpath = dbpath.replace("\\", "/");
|
||||
}
|
||||
return dbpath;
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户信息
|
||||
* @param idSet
|
||||
* @return
|
||||
*/
|
||||
private Map<String, UserAvatar> queryUserAvatar(Set<String> idSet){
|
||||
List<UserAvatar> list = this.baseMapper.queryUserAvatarList(idSet);
|
||||
Map<String, UserAvatar> map = new HashMap<>();
|
||||
if(list!=null && list.size()>0){
|
||||
for(UserAvatar user: list){
|
||||
map.put(user.getId(), user);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.system.entity.SysFiles;
|
||||
import org.jeecg.modules.system.mapper.SysFilesMapper;
|
||||
import org.jeecg.modules.system.service.ISysFilesService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 知识库-文档管理
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysFilesServiceImpl extends ServiceImpl<SysFilesMapper, SysFiles> implements ISysFilesService {
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.jeecg.modules.system.entity.SysFormFile;
|
||||
import org.jeecg.modules.system.mapper.SysFormFileMapper;
|
||||
import org.jeecg.modules.system.service.ISysFormFileService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 表单评论文件
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysFormFileServiceImpl extends ServiceImpl<SysFormFileMapper, SysFormFile> implements ISysFormFileService {
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package org.jeecg.modules.system.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Description: 文档VO
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class SysCommentFileVo {
|
||||
|
||||
/**
|
||||
* sys_files id
|
||||
*/
|
||||
private String fileId;
|
||||
/**
|
||||
* sys_form_file id
|
||||
*/
|
||||
private String sysFormFileId;
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
private Double fileSize;
|
||||
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 文档类型(folder:文件夹 excel:excel doc:word pp:ppt image:图片 archive:其他文档 video:视频)
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 文件上传类型(temp/本地上传(临时文件) manage/知识库)
|
||||
*/
|
||||
private String storeType;
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package org.jeecg.modules.system.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.aspect.annotation.Dict;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: VO 评论信息+文件信息
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2022-07-19
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class SysCommentVO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
private String tableName;
|
||||
/**
|
||||
* 数据id
|
||||
*/
|
||||
private String tableDataId;
|
||||
/**
|
||||
* 来源用户id
|
||||
*/
|
||||
private String fromUserId;
|
||||
/**
|
||||
* 回复内容
|
||||
*/
|
||||
private String commentContent;
|
||||
/**
|
||||
* 创建日期
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 文件信息
|
||||
*/
|
||||
private List<SysCommentFileVo> fileList;
|
||||
|
||||
/**
|
||||
* 发送给用户id(允许为空)
|
||||
*/
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname")
|
||||
private String toUserId;
|
||||
|
||||
/**
|
||||
* 评论id(允许为空,不为空时,则为回复)
|
||||
*/
|
||||
private String commentId;
|
||||
|
||||
/**
|
||||
* 发消息人的realname
|
||||
*/
|
||||
private String fromUserId_dictText;
|
||||
|
||||
/**
|
||||
* 被回复消息人的realname
|
||||
*/
|
||||
private String toUserId_dictText;
|
||||
|
||||
/**
|
||||
* 发消息人的头像
|
||||
*/
|
||||
private String fromUserAvatar;
|
||||
|
||||
/**
|
||||
* 被回复消息人的头像
|
||||
*/
|
||||
private String toUserAvatar;
|
||||
|
||||
public SysCommentVO() {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.jeecg.modules.system.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户名和头像信息
|
||||
* @Author taoYan
|
||||
* @Date 2022/8/8 17:06
|
||||
**/
|
||||
@Data
|
||||
public class UserAvatar {
|
||||
|
||||
private String id;
|
||||
|
||||
private String realname;
|
||||
|
||||
private String avatar;
|
||||
|
||||
}
|
Loading…
Reference in New Issue