修改文件访问路径

This commit is contained in:
haozq 2025-09-23 10:34:54 +08:00
parent 850a816768
commit 49df36e35d
24 changed files with 909 additions and 291 deletions

View File

@ -61,4 +61,7 @@ spring:
merge-sql: true
wall:
config:
multi-statement-allow: true
multi-statement-allow: true
app:
admin:
password: Bonus@admin123

View File

@ -38,6 +38,12 @@
<groupId>com.bonus</groupId>
<artifactId>bonus-file</artifactId>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.2</version>
<scope>compile</scope>
</dependency>
</dependencies>

View File

@ -0,0 +1,108 @@
package com.bonus.business.controller;
import com.bonus.business.domain.TbFileLabel;
import com.bonus.business.domain.TbProduct;
import com.bonus.business.domain.TbPromotionMaterial;
import com.bonus.business.domain.WebFileDto;
import com.bonus.business.service.DockerLabelService;
import com.bonus.common.annotation.Log;
import com.bonus.common.core.controller.BaseController;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.core.page.TableDataInfo;
import com.bonus.common.enums.BusinessType;
import com.bonus.common.utils.FastJsonHelper;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* 稳文档标签管理
*/
@RestController
@RequestMapping("/label")
public class DockerLabelController extends BaseController {
@Autowired
private DockerLabelService service;
/**
* 分页查询标签列表
* @param vo
* @return
*/
@PreAuthorize("@ss.hasPermi('tb:label:list')")
@GetMapping("/list")
public TableDataInfo list(TbFileLabel vo) {
startPage();
List<TbFileLabel> list = service.selectLabelList(vo);
return getDataTable(list);
}
/**
* 下拉选集合
* @param vo
* @return
*/
@PostMapping("/selectedList")
public AjaxResult selectedList(@RequestBody TbFileLabel vo) {
List<TbFileLabel> list = service.selectLabelList(vo);
return AjaxResult.success(list);
}
/**
* 新增文档标签
* @param vo
* @return
*/
@PreAuthorize("@ss.hasPermi('tb:label:add')")
@Log(title = "新增文档标签", businessType = BusinessType.INSERT)
@PostMapping("/addLabel")
public AjaxResult addLabel(@RequestBody TbFileLabel vo) {
try {
return service.addLabel(vo);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return error("系统异常,请联系管理员");
}
}
/**
* 修改文档标签
* @param vo
* @return
*/
@PreAuthorize("@ss.hasPermi('tb:label:update')")
@Log(title = "修改文档标签", businessType = BusinessType.UPDATE)
@PostMapping("/updateLabel")
public AjaxResult updateLabel(@RequestBody TbFileLabel vo) {
try {
return service.updateLabel(vo);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return error("系统异常,请联系管理员");
}
}
/**
* 删除文档标签
* @param vo
* @return
*/
@PreAuthorize("@ss.hasPermi('tb:label:update')")
@Log(title = "删除文档标签", businessType = BusinessType.DELETE)
@PostMapping("/delete")
public AjaxResult delete(@RequestBody TbFileLabel vo) {
try {
return service.delete(vo);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return error("系统异常,请联系管理员");
}
}
}

View File

@ -0,0 +1,80 @@
package com.bonus.business.controller;
import com.bonus.business.domain.TbDocumentFolder;
import com.bonus.business.domain.TbFileLabel;
import com.bonus.business.service.DocumentService;
import com.bonus.common.annotation.Log;
import com.bonus.common.core.controller.BaseController;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.core.page.TableDataInfo;
import com.bonus.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/document")
public class DocumentController extends BaseController {
@Autowired
private DocumentService service;
/**
* 分页查询标签列表
* @param vo
* @return
*/
@PreAuthorize("@ss.hasPermi('tb:document:list')")
@GetMapping("/list")
public TableDataInfo list(TbDocumentFolder vo) {
startPage();
List<TbDocumentFolder> list = service.selectDocumentList(vo);
return getDataTable(list);
}
/**
* 新增文件夹
* @param vo
* @return
*/
@PreAuthorize("@ss.hasPermi('tb:document:add')")
@GetMapping("/addDocument")
@Log(title = "新增文件夹", businessType = BusinessType.INSERT)
public AjaxResult addDocument(TbDocumentFolder vo) {
return service.addDocument(vo);
}
/**
* 新增文件夹
* @param vo
* @return
*/
@PreAuthorize("@ss.hasPermi('tb:document:update')")
@GetMapping("/updateDocument")
@Log(title = "新增文件夹", businessType = BusinessType.INSERT)
public AjaxResult updateDocument(TbDocumentFolder vo) {
return service.updateDocument(vo);
}
/**
* 删除文件夹
* @param vo
* @return
*/
@PreAuthorize("@ss.hasPermi('tb:document:del')")
@GetMapping("/delDocument")
@Log(title = "删除文件夹", businessType = BusinessType.DELETE)
public AjaxResult delDocument(TbDocumentFolder vo) {
return service.delDocument(vo);
}
}

View File

@ -40,4 +40,6 @@ public class MaterialScreenController extends BaseController {
}
}
}

View File

@ -1,26 +1,30 @@
package com.bonus.business.domain;
import com.bonus.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.bonus.common.annotation.Excel;
import java.util.List;
/**
* 文档库文件夹对象 tb_document_folder
*
* @author 黑子
* @date 2025-09-10
*/
@Data
public class TbDocumentFolder extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
private String id;
/** 节点层级 */
@Excel(name = "节点层级")
private Long level;
private int level;
/** 文件夹名称 */
@Excel(name = "文件夹名称")
@ -28,102 +32,42 @@ public class TbDocumentFolder extends BaseEntity
/** 上级节点id */
@Excel(name = "上级节点id")
private Long parentId;
private String parentId;
@Excel(name = "上级节点id")
private String parentIds;
/** 创建人 */
@Excel(name = "创建人")
private Long createUser;
private String createUser;
/** 修改人 */
@Excel(name = "修改人")
private Long updateUser;
private String updateUser;
/** 权限 0 部门可见 1全部可见 */
@Excel(name = "权限 0 部门可见 1全部可见")
private Long authType;
private String authType;
/**
* 类型
*/
private String fileType;
/**
* 用户id
*/
private String userIds;
/**
* 用户名称
*/
private String useName;
/**
* 备注
*/
private String remark;
/**
* 权限集合
*/
private List<TbDocumentFolderAuth> authList;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setLevel(Long level)
{
this.level = level;
}
public Long getLevel()
{
return level;
}
public void setFolderName(String folderName)
{
this.folderName = folderName;
}
public String getFolderName()
{
return folderName;
}
public void setParentId(Long parentId)
{
this.parentId = parentId;
}
public Long getParentId()
{
return parentId;
}
public void setCreateUser(Long createUser)
{
this.createUser = createUser;
}
public Long getCreateUser()
{
return createUser;
}
public void setUpdateUser(Long updateUser)
{
this.updateUser = updateUser;
}
public Long getUpdateUser()
{
return updateUser;
}
public void setAuthType(Long authType)
{
this.authType = authType;
}
public Long getAuthType()
{
return authType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("level", getLevel())
.append("folderName", getFolderName())
.append("parentId", getParentId())
.append("createTime", getCreateTime())
.append("createUser", getCreateUser())
.append("updateTime", getUpdateTime())
.append("updateUser", getUpdateUser())
.append("authType", getAuthType())
.toString();
}
}

View File

@ -4,6 +4,7 @@ import java.util.Date;
import com.bonus.common.core.domain.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.bonus.common.annotation.Excel;
@ -14,31 +15,34 @@ import com.bonus.common.annotation.Excel;
* @author 黑子
* @date 2025-09-10
*/
@Data
public class TbDocumentFolderAuth extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 用户名 */
private String userName;
/** 文件夹id */
private Long folderId;
private String folderId;
/** 用户id */
private Long userId;
private String userId;
/** 文件夹权限 0 普通权限 1管理员 */
@Excel(name = "文件夹权限 0 普通权限 1管理员")
private Long folderType;
private String folderType;
/** 文件夹来源 0自建 1共享 3副本 */
@Excel(name = "文件夹来源 0自建 1共享 3副本")
private Long folderSource;
private String folderSource;
/** 文件夹权限 0 查看 1 查看下载 2 编辑 3 管理 */
@Excel(name = "文件夹权限 0 查看 1 查看下载 2 编辑 3 管理")
private Long folderAuth;
private String folderAuth;
/** 是否共享 0 共享 1 */
@Excel(name = "是否共享 0 共享 1")
private Long isShare;
private String isShare;
/** 共享开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@ -49,97 +53,4 @@ public class TbDocumentFolderAuth extends BaseEntity
@Excel(name = "共享天数")
private Long shareDay;
public void setFolderId(Long folderId)
{
this.folderId = folderId;
}
public Long getFolderId()
{
return folderId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setFolderType(Long folderType)
{
this.folderType = folderType;
}
public Long getFolderType()
{
return folderType;
}
public void setFolderSource(Long folderSource)
{
this.folderSource = folderSource;
}
public Long getFolderSource()
{
return folderSource;
}
public void setFolderAuth(Long folderAuth)
{
this.folderAuth = folderAuth;
}
public Long getFolderAuth()
{
return folderAuth;
}
public void setIsShare(Long isShare)
{
this.isShare = isShare;
}
public Long getIsShare()
{
return isShare;
}
public void setShareTime(Date shareTime)
{
this.shareTime = shareTime;
}
public Date getShareTime()
{
return shareTime;
}
public void setShareDay(Long shareDay)
{
this.shareDay = shareDay;
}
public Long getShareDay()
{
return shareDay;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("folderId", getFolderId())
.append("userId", getUserId())
.append("folderType", getFolderType())
.append("folderSource", getFolderSource())
.append("folderAuth", getFolderAuth())
.append("isShare", getIsShare())
.append("shareTime", getShareTime())
.append("shareDay", getShareDay())
.toString();
}
}

View File

@ -1,6 +1,8 @@
package com.bonus.business.domain;
import com.bonus.common.core.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.bonus.common.annotation.Excel;
@ -11,6 +13,8 @@ import com.bonus.common.annotation.Excel;
* @author 黑子
* @date 2025-09-10
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class TbFileLabel extends BaseEntity
{
private static final long serialVersionUID = 1L;
@ -20,7 +24,7 @@ public class TbFileLabel extends BaseEntity
/** 标签名称 */
@Excel(name = "标签名称")
private String laberName;
private String labelName;
/** 类型id */
@Excel(name = "类型id")
@ -41,88 +45,5 @@ public class TbFileLabel extends BaseEntity
/** 删除状态 */
private String delFlag;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setLaberName(String laberName)
{
this.laberName = laberName;
}
public String getLaberName()
{
return laberName;
}
public void setTypeId(Long typeId)
{
this.typeId = typeId;
}
public Long getTypeId()
{
return typeId;
}
public void setTypeName(String typeName)
{
this.typeName = typeName;
}
public String getTypeName()
{
return typeName;
}
public void setCreateUser(Long createUser)
{
this.createUser = createUser;
}
public Long getCreateUser()
{
return createUser;
}
public void setUpdateUser(Long updateUser)
{
this.updateUser = updateUser;
}
public Long getUpdateUser()
{
return updateUser;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("laberName", getLaberName())
.append("typeId", getTypeId())
.append("typeName", getTypeName())
.append("createTime", getCreateTime())
.append("createUser", getCreateUser())
.append("updateUser", getUpdateUser())
.append("updateTime", getUpdateTime())
.append("delFlag", getDelFlag())
.toString();
}
}

View File

@ -0,0 +1,52 @@
package com.bonus.business.mapper;
import com.bonus.business.domain.TbFileLabel;
import com.bonus.business.domain.TbProduct;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface DockerLabelMapper {
/**
* 查询 标签数据集合
* @param vo
* @return
*/
List<TbFileLabel> selectLabelList(TbFileLabel vo);
/**
* 查询标签名称
* @param vo
* @return
*/
Integer getLabelNumByName(TbFileLabel vo);
/**
* 新增·标签数据
* @param vo
* @return
*/
int addLabel(TbFileLabel vo);
/**
* 更新
* @param vo
* @return
*/
int updateLabel(TbFileLabel vo);
/**
* 查询 标签是否被使用
* @param vo
* @return
*/
Integer getLabelNumById(TbFileLabel vo);
/**
* 删除数据
* @param vo
* @return
*/
int updateLabelStatus(TbFileLabel vo);
}

View File

@ -0,0 +1,74 @@
package com.bonus.business.mapper;
import com.bonus.business.domain.TbDocumentFolder;
import com.bonus.business.domain.TbDocumentFolderAuth;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface DocumentMapper {
/**
* 文档分页下拉选查询
* @param vo
* @return
*/
List<TbDocumentFolder> selectDocumentList(TbDocumentFolder vo);
/**
* 查询文档权限用户
* @param tbDocumentFolder
* @return
*/
List<TbDocumentFolderAuth> getUserList(TbDocumentFolder tbDocumentFolder);
/**
* 查询文档是否存在
* @param vo
* @return
*/
String getDocumentByName(TbDocumentFolder vo);
/**
* 新增文档内容
* @param vo
* @return
*/
int addDocument(TbDocumentFolder vo);
/**
* 授权角色管理菜单
* @param ids
* @param id
* @return
*/
int addDocumentAuth(@Param("list") List<String> ids, @Param("id") String id);
/**
* 跟新文件夹名称
* @param vo
* @return
*/
int updateDocument(TbDocumentFolder vo);
/**
* 删除原来授权的数据
* @param vo
*/
void deleteAuth(TbDocumentFolder vo);
/**
* 查询 子节点数据
* @param vo
* @return
*/
// int getChilderNum(TbDocumentFolder vo);
/**
* 删除数据及子节点
* @param vo
*/
void delDocument(TbDocumentFolder vo);
}

View File

@ -0,0 +1,37 @@
package com.bonus.business.service;
import com.bonus.business.domain.TbFileLabel;
import com.bonus.business.domain.TbProduct;
import com.bonus.common.core.domain.AjaxResult;
import java.util.List;
public interface DockerLabelService {
/**
* 查询标签集合
* @param vo
* @return
*/
List<TbFileLabel> selectLabelList(TbFileLabel vo);
/**
* 新增标签
* @param vo
* @return
*/
AjaxResult addLabel(TbFileLabel vo);
/**
* 修改标签
* @param vo
* @return
*/
AjaxResult updateLabel(TbFileLabel vo);
/**
* 删除数据
* @param vo
* @return
*/
AjaxResult delete(TbFileLabel vo);
}

View File

@ -0,0 +1,36 @@
package com.bonus.business.service;
import com.bonus.business.domain.TbDocumentFolder;
import com.bonus.common.core.domain.AjaxResult;
import java.util.List;
public interface DocumentService {
/**
* 文档管理 分页查询
* @param vo
* @return
*/
List<TbDocumentFolder> selectDocumentList(TbDocumentFolder vo);
/**
* 新增文档
* @param vo
* @return
*/
AjaxResult addDocument(TbDocumentFolder vo);
/**
* 修改文档数据
* @param vo
* @return
*/
AjaxResult updateDocument(TbDocumentFolder vo);
/**
* 删除文档中心数据
* @param vo
* @return
*/
AjaxResult delDocument(TbDocumentFolder vo);
}

View File

@ -0,0 +1,104 @@
package com.bonus.business.service.impl;
import com.bonus.business.domain.TbFileLabel;
import com.bonus.business.domain.TbProduct;
import com.bonus.business.mapper.DockerLabelMapper;
import com.bonus.business.service.DockerLabelService;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
@Service
@Slf4j
public class DockerLabelServiceImpl implements DockerLabelService {
@Autowired
private DockerLabelMapper mapper;
/**
* 分页查询
* @param vo
* @return
*/
@Override
public List<TbFileLabel> selectLabelList(TbFileLabel vo) {
try{
return mapper.selectLabelList(vo);
}catch (Exception e){
log.error(e.getMessage(),e);
}
return Collections.emptyList();
}
/**
* 新增标签文档
* @param vo
* @return
*/
@Override
public AjaxResult addLabel(TbFileLabel vo) {
try{
Integer num=mapper.getLabelNumByName(vo);
if (num!=null && num>0){
return AjaxResult.error("标签名称已存在!");
}
vo.setCreateUser(SecurityUtils.getUserId());
vo.setUpdateUser(SecurityUtils.getUserId());
int addNum=mapper.addLabel(vo);
if (addNum>0){
return AjaxResult.success("添加成功");
}
}catch (Exception e){
log.error(e.getMessage(),e);
}
return AjaxResult.error("新增失败");
}
@Override
public AjaxResult updateLabel(TbFileLabel vo) {
try{
Integer num=mapper.getLabelNumByName(vo);
if (num!=null && num>0){
return AjaxResult.error("标签名称已存在!");
}
vo.setUpdateUser(SecurityUtils.getUserId());
int addNum=mapper.updateLabel(vo);
if (addNum>0){
return AjaxResult.success("修改成功");
}
}catch (Exception e){
log.error(e.getMessage(),e);
}
return AjaxResult.error("修改失败");
}
/**
* 删除
* @param vo
* @return
*/
@Override
public AjaxResult delete(TbFileLabel vo) {
try{
Integer num=mapper.getLabelNumById(vo);
if (num!=null && num>0){
return AjaxResult.error("标签已被使用不允许删除!");
}
vo.setUpdateUser(SecurityUtils.getUserId());
int delNum=mapper.updateLabelStatus(vo);
if (delNum>0){
return AjaxResult.success("删除成功");
}
}catch (Exception e){
log.error(e.getMessage(),e);
}
return AjaxResult.error("删除失败");
}
}

View File

@ -0,0 +1,140 @@
package com.bonus.business.service.impl;
import com.bonus.business.domain.TbDocumentFolder;
import com.bonus.business.domain.TbDocumentFolderAuth;
import com.bonus.business.mapper.DocumentMapper;
import com.bonus.business.service.DocumentService;
import com.bonus.common.core.domain.AjaxResult;
import com.bonus.common.utils.SecurityUtils;
import com.bonus.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@Service
@Slf4j
public class DocumentServiceImpl implements DocumentService {
@Autowired
private DocumentMapper mapper;
@Override
public List<TbDocumentFolder> selectDocumentList(TbDocumentFolder vo) {
try{
List<TbDocumentFolder> list=mapper.selectDocumentList(vo);
for (TbDocumentFolder tbDocumentFolder : list) {
List<TbDocumentFolderAuth> authList=mapper.getUserList(tbDocumentFolder);
if(StringUtils.isNotEmpty(authList)){
String result = authList.stream()
.map(TbDocumentFolderAuth::getUserName)
.collect(Collectors.joining());
tbDocumentFolder.setUseName(result);
tbDocumentFolder.setAuthList(authList);
}
}
return list;
}catch (Exception e){
log.error(e.toString(),e);
}
return Collections.emptyList();
}
/**
* 新增 文档
* @param vo
* @return
*/
@Override
public AjaxResult addDocument(TbDocumentFolder vo) {
try{
String userId=vo.getUserIds();
if(StringUtils.isEmpty(userId)){
return AjaxResult.error("请选择管理员");
}
String isCz=mapper.getDocumentByName(vo);
if(StringUtils.isNotEmpty(isCz)){
return AjaxResult.error("文件夹名称已存在");
}
//默认层级
vo.setLevel(1);
vo.setParentId("0");
vo.setParentIds("0,");
vo.setCreateUser(SecurityUtils.getUserId().toString());
vo.setUpdateUser(SecurityUtils.getUserId().toString());
int num =mapper.addDocument(vo);
if(num<1){
return AjaxResult.error("文件夹创建失败");
}
return getAjaxResult(vo, userId);
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("添加失败");
}
/**
* 修改文档权限
* @param vo
* @return
*/
@Override
public AjaxResult updateDocument(TbDocumentFolder vo) {
try{
String userId=vo.getUserIds();
if(StringUtils.isEmpty(userId)){
return AjaxResult.error("请选择管理员");
}
String isCz=mapper.getDocumentByName(vo);
if(StringUtils.isNotEmpty(isCz)){
return AjaxResult.error("文件夹名称已存在");
}
//默认层
vo.setUpdateUser(SecurityUtils.getUserId().toString());
int num =mapper.updateDocument(vo);
if(num<1){
return AjaxResult.error("文件夹创建失败");
}
mapper.deleteAuth(vo);
return getAjaxResult(vo, userId);
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("添加失败");
}
/**
* 删除文档中心
* @param vo
* @return
*/
@Override
public AjaxResult delDocument(TbDocumentFolder vo) {
try{
// int child=mapper.getChildNum(vo);
//删除 其及子节点
vo.setParentIds(vo.getId()+",");
mapper.delDocument(vo);
}catch (Exception e){
log.error(e.toString(),e);
}
return AjaxResult.error("添加失败");
}
public AjaxResult getAjaxResult(TbDocumentFolder vo, String userId) {
List<String> ids= Arrays.asList(userId.split(","));
int addIds= mapper.addDocumentAuth(ids,vo.getId());
if(addIds!=ids.size()){
return AjaxResult.error("文件夹授权失败");
}
return AjaxResult.success("文件夹授权成功");
}
}

View File

@ -0,0 +1,42 @@
package com.bonus.business.service.impl;
import com.bonus.business.global.GlobalUtils;
import com.bonus.common.config.MinioConfig;
import com.bonus.common.utils.StringUtils;
import com.bonus.file.minio.MinioUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
@Slf4j
public class FileServiceUtils {
@Resource
private MinioConfig minioConfig;
@Autowired
public MinioUtil minioUtil;
public String getFileUrl(String fileName,String bucketName) {
try{
if(StringUtils.isEmpty(bucketName)){
bucketName = minioConfig.getBucketName();
}
String url= minioUtil.getFileUrl(bucketName,fileName, GlobalUtils.FILE_TIMES);
if(url.startsWith(minioConfig.getEndpoint())){
url=url.replace(minioConfig.getEndpoint(),minioConfig.getUrl());
}
return url;
}catch (Exception e){
log.error(e.toString(),e);
}
return "";
}
}

View File

@ -37,7 +37,6 @@ public class MaterialScreenServiceImpl implements MaterialScreenService {
@Override
public List<TbPromotionMaterial> getMaterialList(TbPromotionMaterial o) {
List<TbPromotionMaterial> list = mapper.getMaterialList(o);
if (StringUtils.isNotEmpty(list)) {
list.forEach(vo -> {

View File

@ -37,13 +37,18 @@ public class ProductScreenImpl implements ProductScreenService {
public MinioUtil minioUtil;
@Autowired
public FileServiceUtils fileServiceUtils;
@Override
public AjaxResult getProductList(TbProduct product) {
try{
List<TbProduct> list=mapper.getProductList(product);
if(StringUtils.isNotEmpty(list)){
list.forEach(vo->{
String url = minioUtil.getFileUrl(minioConfig.getBucketName(),vo.getLinkImage(), GlobalUtils.FILE_TIMES);
String url = fileServiceUtils.getFileUrl(vo.getLinkImage(),null);
// String url = minioUtil.getFileUrl(minioConfig.getBucketName(),vo.getLinkImage(), GlobalUtils.FILE_TIMES);
vo.setLinkImage(url);
});
}
@ -66,7 +71,8 @@ public class ProductScreenImpl implements ProductScreenService {
TbProduct vo=mapper.getProductDetails(product);
if(vo!=null){
//封面图
String url = minioUtil.getFileUrl(minioConfig.getBucketName(),vo.getLinkImage(), GlobalUtils.FILE_TIMES);
String url = fileServiceUtils.getFileUrl(vo.getLinkImage(),null);
// String url = minioUtil.getFileUrl(minioConfig.getBucketName(),vo.getLinkImage(), GlobalUtils.FILE_TIMES);
vo.setLinkImage(url);
// vo.setLinkImage(minioConfig.getUrl()+"/"+minioConfig.getBucketName()+vo.getLinkImage());
getProductDetails(product, vo, productMapper, minioUtil);
@ -76,8 +82,10 @@ public class ProductScreenImpl implements ProductScreenService {
List<ProductScreenVo> fileList=new ArrayList<>();
if(StringUtils.isNotEmpty(list)){
list.forEach(vo1->{
String imageUlr = minioUtil.getFileUrl(minioConfig.getBucketName(),vo1.getImage(), GlobalUtils.FILE_TIMES);
String path = minioUtil.getFileUrl(minioConfig.getBucketName(),vo1.getFilePath(), GlobalUtils.FILE_TIMES);
String imageUlr = fileServiceUtils.getFileUrl(vo1.getImage(),null);
String path = fileServiceUtils.getFileUrl(vo1.getFilePath(),null);
// String imageUlr = minioUtil.getFileUrl(minioConfig.getBucketName(),vo1.getImage(), GlobalUtils.FILE_TIMES);
// String path = minioUtil.getFileUrl(minioConfig.getBucketName(),vo1.getFilePath(), GlobalUtils.FILE_TIMES);
vo1.setImage(imageUlr);
vo1.setUrl(path);
if("0".equals(vo1.getFileType())){
@ -97,14 +105,15 @@ public class ProductScreenImpl implements ProductScreenService {
return AjaxResult.success(product);
}
public static void getProductDetails(TbProduct product, TbProduct vo, ProductMapper productMapper, MinioUtil minioUtil) {
public void getProductDetails(TbProduct product, TbProduct vo, ProductMapper productMapper, MinioUtil minioUtil) {
List<TbProductCase> productCases= productMapper.getProductCaseList(product.getId());
for (TbProductCase productCase:productCases) {
//产品案例
List<ProductCaseImage> caseImages= productMapper.getCaseImageByTable(productCase.getId(),"tb_product_case");
if(StringUtils.isNotEmpty(caseImages)){
caseImages.forEach(image->{
String path = minioUtil.getFileUrl(image.getBucketName(),image.getFilePath(), GlobalUtils.FILE_TIMES);
String path = fileServiceUtils.getFileUrl(image.getFilePath(),image.getBucketName());
// String path = minioUtil.getFileUrl(image.getBucketName(),image.getFilePath(), GlobalUtils.FILE_TIMES);
image.setUrl(path);
});
productCase.setImageList(caseImages);

View File

@ -4,7 +4,6 @@ import com.alibaba.fastjson2.JSON;
import com.bonus.business.domain.ProductCaseImage;
import com.bonus.business.domain.TbProduct;
import com.bonus.business.domain.TbProductCase;
import com.bonus.business.global.GlobalUtils;
import com.bonus.business.mapper.ProductMapper;
import com.bonus.business.service.ProductService;
import com.bonus.common.config.MinioConfig;
@ -15,10 +14,8 @@ import com.bonus.common.utils.StringUtils;
import com.bonus.file.minio.MinioUtil;
import com.bonus.file.service.FileUploadService;
import com.google.common.collect.Maps;
import com.google.common.collect.Table;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
@ -44,6 +41,11 @@ public class ProductServiceImpl implements ProductService {
@Autowired
public MinioUtil minioUtil;
@Autowired
public ProductScreenImpl productScreenService;
@Autowired
public FileServiceUtils fileServiceUtils;
public String day= DateUtils.getCurrentYear();
@ -62,7 +64,7 @@ public class ProductServiceImpl implements ProductService {
List<TbProduct> list=mapper.selectProductList(product);
if(StringUtils.isNotEmpty(list)){
list.forEach(vo->{
String url = minioUtil.getFileUrl(minioConfig.getBucketName(),vo.getLinkImage(), GlobalUtils.FILE_TIMES);
String url = fileServiceUtils.getFileUrl(vo.getLinkImage(),null);
vo.setLinkImage(url);
// vo.setLinkImage(minioConfig.getUrl()+"/"+minioConfig.getBucketName()+vo.getLinkImage());
});
@ -242,12 +244,12 @@ public class ProductServiceImpl implements ProductService {
List<ProductCaseImage> list=mapper.getCaseImageByTable(product.getId(),"tb_product");
if(StringUtils.isNotEmpty(list)){
ProductCaseImage vo1=list.get(0);
String url=minioUtil.getFileUrl(vo1.getBucketName(),vo1.getFilePath(), GlobalUtils.FILE_TIMES);
String url = fileServiceUtils.getFileUrl(vo1.getFilePath(),null);
vo1.setUrl(url);
// vo1.setUrl(minioConfig.getUrl()+"/"+vo1.getBucketName()+vo1.getFilePath());
vo.setImage(vo1);
}
ProductScreenImpl.getProductDetails(product, vo, mapper, minioUtil);
productScreenService.getProductDetails(product, vo, mapper, minioUtil);
}
return AjaxResult.success(vo);

View File

@ -46,6 +46,9 @@ public class TbPromotionMaterialServiceImpl implements ITbPromotionMaterialServi
@Resource
private FileUploadService fileUploadService;
@Autowired
public FileServiceUtils fileServiceUtils;
public String day= DateUtils.getCurrentYear();
public String month=DateUtils.getCurrentMonth();
@ -65,12 +68,14 @@ public class TbPromotionMaterialServiceImpl implements ITbPromotionMaterialServi
for (TbPromotionMaterial bean : tbPromotionMaterials) {
//查询附件
bean.setType("2");
String imageUlr = minioUtil.getFileUrl(minioConfig.getBucketName(),bean.getImage(), GlobalUtils.FILE_TIMES);
String imageUlr = fileServiceUtils.getFileUrl(bean.getImage(),null);
// String imageUlr = minioUtil.getFileUrl(minioConfig.getBucketName(),bean.getImage(), GlobalUtils.FILE_TIMES);
bean.setImage(imageUlr);
List<TbPromotionMaterialFiles> files = mapper.getFileMaterialId(bean);
//拼接个访问前缀
for (TbPromotionMaterialFiles o: files) {
String path = minioUtil.getFileUrl(minioConfig.getBucketName(),o.getFilePath(),GlobalUtils.FILE_TIMES);
String path = fileServiceUtils.getFileUrl(o.getFilePath(),null);
// String path = minioUtil.getFileUrl(minioConfig.getBucketName(),o.getFilePath(),GlobalUtils.FILE_TIMES);
o.setFilePath(path);
}
bean.setFiles(files);
@ -92,7 +97,8 @@ public class TbPromotionMaterialServiceImpl implements ITbPromotionMaterialServi
List<TbPromotionMaterialFiles> files = mapper.getFileMaterialId(bean);
//拼接个访问前缀
for (TbPromotionMaterialFiles o: files) {
String filePath = minioUtil.getFileUrl(minioConfig.getBucketName(),o.getFilePath(), GlobalUtils.FILE_TIMES);
String filePath = fileServiceUtils.getFileUrl(o.getFilePath(),null);
// String filePath = minioUtil.getFileUrl(minioConfig.getBucketName(),o.getFilePath(), GlobalUtils.FILE_TIMES);
o.setFilePath(filePath);
}
bean.setFiles(files);

View File

@ -0,0 +1,53 @@
<?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.bonus.business.mapper.DockerLabelMapper">
<insert id="addLabel">
insert into tb_file_label(
label_name,type_id,type_name,create_time,create_user,
update_user,update_time,del_flag
)values (#{labelName},#{typeId},#{typeName},now(),#{createUser},#{updateUser},now(),0)
</insert>
<update id="updateLabel">
update tb_file_label set
label_name=#{labelName},type_id=#{typeId},type_name=#{typeName}
, update_user =#{updateUser},update_time=now()
WHERE id=#{id}
</update>
<update id="updateLabelStatus">
update tb_file_label set del_flag=1, update_user =#{updateUser},update_time=now()
WHERE id=#{id}
</update>
<!--查询下拉选-->
<select id="selectLabelList" resultType="com.bonus.business.domain.TbFileLabel">
select tfl.id, tfl.label_name labelName,tfl.type_id typeId,
tfl. type_name typeName, tfl.create_time createTime,
tfl.create_user , tfl.update_user, tfl.update_time,
su.user_name createUser
from tb_file_label tfl
left join sys_user su on su.user_id=tfl.create_user
where tfl.del_flag=0
<if test="typeId!=null and typeId!=''">
and tfl.type_id=#{typeId}
</if>
<if test="labelName!=null and labelName!=''">
and tfl.label_name like concat('%',#{labelName},'%')
</if>
</select>
<select id="getLabelNumByName" resultType="java.lang.Integer">
select count(1)
from tb_file_label
where del_flag=0 and label_name=#{labelName}
<if test="id!=null and id!=''">
and id!=#{id}
</if>
</select>
<select id="getLabelNumById" resultType="java.lang.Integer">
select count(1)
from tb_document_files_label
where label_id=#{id}
</select>
</mapper>

View File

@ -0,0 +1,75 @@
<?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.bonus.business.mapper.DocumentMapper">
<!--新增文档内容-->
<insert id="addDocument" useGeneratedKeys="true" keyProperty="id">
insert into tb_document_folder(
level,folder_name,parent_id, create_time, create_user, update_time,update_user, file_type, del_flag,parent_ids
)values (#{level},#{folderName},#{parentId},now(),#{createUser},now(),#{updateUser},#{fileType},0,#{parentIds})
</insert>
<!--新增菜单权限-->
<insert id="addDocumentAuth">
insert into tb_document_folder(folder_id, user_id,folder_type, folder_source, folder_auth, is_share) value
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{id},#{item},0,1,0,1,
</foreach>
</insert>
<update id="updateDocument">
update tb_document_folder set
folder_name=#{folderName},update_time=#{updateTime} ,update_user=#{updateUser}
where id=#{id}
where
</update>
<delete id="deleteAuth">
delete from tb_document_folder_auth WHERE folder_id=#{id}
</delete>
<!--已删除的数据-->
<delete id="delDocument">
update tb_document_folder set del_flag= where parent_ids like concat('%',#{parentIds},'%')
</delete>
<delete id="delDocumentFile">
update tb_document_files set del_flag= where parent_ids like concat('%',#{parentIds},'%')
</delete>
<!--查询文档中心 数据-->
<select id="selectDocumentList" resultType="com.bonus.business.domain.TbDocumentFolder">
select tdf.id, tdf.level, tdf.folder_name folderName,
tdf.parent_id parentId, tdf.create_time createTime,
tdf.update_time, update_user,tdf.file_type fileType ,
su.user_name createUser
from tb_document_folder tdf
left join sys_user su on su.user_id=tdf.create_user
where tdf.parent_id=0 and tdf.del_flag=0
<if test="folderName!=null and folderName!=''">
and tdf.folder_name like concat('%',#{folderName},'%')
</if>
<if test="fileType!=null and fileType!=''">
and tdf.file_type=#{fileType}
</if>
</select>
<select id="getUserList" resultType="com.bonus.business.domain.TbDocumentFolderAuth">
select dfa.user_id createUser,su.user_name userName,
from tb_document_folder_auth
left join sys_user su on su.user_id=dfa.user_id
WHERE dfa.folder_id=#{id}
</select>
<select id="getDocumentByName" resultType="java.lang.String">
select id
from tb_document_folder
where del_flag =0 and folder_name=#{folderName}
<if test="id!=null and id!=''">
and id !=#{id}
</if>
</select>
<select id="getChildNum" resultType="java.lang.Integer">
select
</select>
</mapper>

View File

@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getProductList" resultType="com.bonus.business.domain.TbProduct">
select tpt.id, tpt.name, tpt.type_id typeId, sdd.dict_label typeName,
tpt.link_url linkUrl, tpt.link_image linkImage, tpt.link_user linkUser, tpt.link_password linkPassword, tpt.is_link isLink,
tpt.introduction introduction, tpt.create_time createTime,su.nick_name createUser,is_access isAccess
tpt.introduction introduction, tpt.create_time createTime,su.user_name createUser,is_access isAccess
from tb_product tpt
left join sys_dict_data sdd on sdd.dict_value=tpt.type_id and sdd.dict_type='tb_product_type'
left join sys_user su on su.user_id=tpt.create_user

View File

@ -8,7 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectProductList" resultType="com.bonus.business.domain.TbProduct">
select tpt.id, tpt.name, tpt.type_id typeId, sdd.dict_label typeName,
tpt.link_url linkUrl, tpt.link_image linkImage, tpt.link_user linkUser, tpt.link_password linkPassword, tpt.is_link isLink,
tpt.introduction introduction, tpt.create_time createTime,su.nick_name createUser,is_access isAccess
tpt.introduction introduction, tpt.create_time createTime,su.user_name createUser,is_access isAccess
from tb_product tpt
left join sys_dict_data sdd on sdd.dict_value=tpt.type_id and sdd.dict_type='tb_product_type'
left join sys_user su on su.user_id=tpt.create_user

View File

@ -17,6 +17,12 @@ import lombok.Data;
public class BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
/**
* 是否是管理员
*/
private String isAdmin;
/** 搜索值 */
@JsonIgnore
@ -116,4 +122,12 @@ public class BaseEntity implements Serializable
{
this.params = params;
}
public String getIsAdmin() {
return isAdmin;
}
public void setIsAdmin(String isAdmin) {
this.isAdmin = isAdmin;
}
}