release-v1.0 #1
@ -96,4 +96,12 @@ public class Document extends BaseEntity {
|
|||||||
|
|
||||||
|
|
||||||
private List<String> excludeFields;
|
private List<String> excludeFields;
|
||||||
|
|
||||||
|
private Boolean downloadCheck;
|
||||||
|
|
||||||
|
private Boolean downloadStatus;
|
||||||
|
|
||||||
|
private Boolean permissionCheck;
|
||||||
|
|
||||||
|
private Boolean permission;
|
||||||
}
|
}
|
||||||
|
@ -38,5 +38,6 @@ public class DownloadCount extends BaseEntity
|
|||||||
private String toolName;
|
private String toolName;
|
||||||
/** 工具下载数量 */
|
/** 工具下载数量 */
|
||||||
private String toolDownNum;
|
private String toolDownNum;
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
package com.rzdata.web.service.impl;
|
package com.rzdata.web.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.BooleanUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.rzdata.common.constant.Constants;
|
import com.rzdata.common.constant.Constants;
|
||||||
import com.rzdata.common.core.domain.entity.SysDictData;
|
import com.rzdata.common.core.domain.entity.SysDictData;
|
||||||
|
import com.rzdata.common.core.domain.entity.SysUser;
|
||||||
|
import com.rzdata.common.core.domain.model.LoginUser;
|
||||||
|
import com.rzdata.common.enums.RecordStatusEnum;
|
||||||
import com.rzdata.common.utils.DateUtils;
|
import com.rzdata.common.utils.DateUtils;
|
||||||
import com.rzdata.common.utils.SecurityUtils;
|
import com.rzdata.common.utils.SecurityUtils;
|
||||||
import com.rzdata.system.service.ISysDictTypeService;
|
import com.rzdata.system.service.ISysDictTypeService;
|
||||||
@ -14,6 +18,7 @@ import com.rzdata.web.domain.Document;
|
|||||||
import com.rzdata.web.domain.Tool;
|
import com.rzdata.web.domain.Tool;
|
||||||
import com.rzdata.web.mapper.DocumentMapper;
|
import com.rzdata.web.mapper.DocumentMapper;
|
||||||
import com.rzdata.web.service.IDocumentService;
|
import com.rzdata.web.service.IDocumentService;
|
||||||
|
import com.rzdata.web.service.IUseApplyService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -37,6 +42,9 @@ public class DocumentServiceImpl implements IDocumentService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ToolServiceImpl toolService;
|
private ToolServiceImpl toolService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IUseApplyService iUseApplyService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISysDictTypeService sysDictTypeService;
|
private ISysDictTypeService sysDictTypeService;
|
||||||
|
|
||||||
@ -73,6 +81,11 @@ public class DocumentServiceImpl implements IDocumentService
|
|||||||
@Override
|
@Override
|
||||||
public List<Document> selectDocumentList(Document document)
|
public List<Document> selectDocumentList(Document document)
|
||||||
{
|
{
|
||||||
|
if (BooleanUtil.isTrue(document.getPermissionCheck())) {
|
||||||
|
if(!SysUser.isAdmin(SecurityUtils.getUserId())){
|
||||||
|
document.setPermission(SecurityUtils.hasPermi(Constants.DOC_VIEW_PERMISSION));
|
||||||
|
}
|
||||||
|
}
|
||||||
List<Document> documents = documentMapper.selectDocumentList(document);
|
List<Document> documents = documentMapper.selectDocumentList(document);
|
||||||
if(CollUtil.isEmpty(documents)){
|
if(CollUtil.isEmpty(documents)){
|
||||||
return documents;
|
return documents;
|
||||||
@ -93,6 +106,21 @@ public class DocumentServiceImpl implements IDocumentService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//前端传传参开启下载权限验证
|
||||||
|
if (BooleanUtil.isTrue(document.getDownloadCheck())) {
|
||||||
|
String userId = SecurityUtils.getUserId().toString();
|
||||||
|
for (Document dc: documents) {
|
||||||
|
//文档中 是创建人 或者 配置了下载权限
|
||||||
|
boolean downStatus = false;
|
||||||
|
if(SecurityUtils.hasPermi(Constants.DOC_DOWNLOAD_PERMISSION) || userId.equals(dc.getCreateById()) || SysUser.isAdmin(SecurityUtils.getUserId())){
|
||||||
|
downStatus = true;
|
||||||
|
}else if(StrUtil.isNotBlank(dc.getToolId()) && iUseApplyService.checkUseApply(dc.getToolId(),userId)){
|
||||||
|
downStatus = true;
|
||||||
|
}
|
||||||
|
dc.setDownloadStatus(downStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
return documents;
|
return documents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package com.rzdata.web.service.impl;
|
package com.rzdata.web.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import cn.hutool.core.lang.Snowflake;
|
||||||
import com.rzdata.common.utils.DateUtils;
|
import com.rzdata.common.utils.DateUtils;
|
||||||
|
import com.rzdata.common.utils.SecurityUtils;
|
||||||
import com.rzdata.web.domain.DownloadCount;
|
import com.rzdata.web.domain.DownloadCount;
|
||||||
import com.rzdata.web.mapper.DownloadCountMapper;
|
import com.rzdata.web.mapper.DownloadCountMapper;
|
||||||
import com.rzdata.web.service.IDownloadCountService;
|
import com.rzdata.web.service.IDownloadCountService;
|
||||||
@ -20,6 +23,9 @@ public class DownloadCountServiceImpl implements IDownloadCountService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private DownloadCountMapper downloadCountMapper;
|
private DownloadCountMapper downloadCountMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private Snowflake snowflake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询工具下载统计
|
* 查询工具下载统计
|
||||||
*
|
*
|
||||||
@ -53,7 +59,10 @@ public class DownloadCountServiceImpl implements IDownloadCountService
|
|||||||
@Override
|
@Override
|
||||||
public int insertDownloadCount(DownloadCount downloadCount)
|
public int insertDownloadCount(DownloadCount downloadCount)
|
||||||
{
|
{
|
||||||
|
downloadCount.setId(String.valueOf(snowflake.nextId()));
|
||||||
downloadCount.setCreateTime(DateUtils.getNowDate());
|
downloadCount.setCreateTime(DateUtils.getNowDate());
|
||||||
|
downloadCount.setCreateBy(SecurityUtils.getLoginUser().getUsername());
|
||||||
|
downloadCount.setCreateById(String.valueOf(SecurityUtils.getLoginUser().getUserId()));
|
||||||
return downloadCountMapper.insertDownloadCount(downloadCount);
|
return downloadCountMapper.insertDownloadCount(downloadCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,9 @@
|
|||||||
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
|
||||||
AND date_format(td.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
AND date_format(td.create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="createById != null and createById != '' and permission != true">
|
||||||
|
AND (td.create_by_id = #{createById} or td.doc_status = 'yfb')
|
||||||
|
</if>
|
||||||
and td.is_deleted = '0'
|
and td.is_deleted = '0'
|
||||||
</where>
|
</where>
|
||||||
order by td.create_time desc
|
order by td.create_time desc
|
||||||
|
@ -16,6 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="toolCode" column="tool_code" />
|
<result property="toolCode" column="tool_code" />
|
||||||
<result property="toolName" column="tool_name" />
|
<result property="toolName" column="tool_name" />
|
||||||
<result property="toolDownNum" column="tool_down_num" />
|
<result property="toolDownNum" column="tool_down_num" />
|
||||||
|
<result property="nickName" column="nick_name" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDownloadCountVo">
|
<sql id="selectDownloadCountVo">
|
||||||
@ -95,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="userDownList" parameterType="DownloadCount" resultMap="DownloadCountResult">
|
<select id="userDownList" parameterType="DownloadCount" resultMap="DownloadCountResult">
|
||||||
select
|
select
|
||||||
tdc.tool_id,su.nick_name,t1.,sum(1) as tool_down_num
|
tdc.tool_id,su.nick_name,tdc.create_time,sum(1) as tool_down_num
|
||||||
from t_download_count tdc
|
from t_download_count tdc
|
||||||
left join sys_user su on tdc.create_by_id = su.user_id
|
left join sys_user su on tdc.create_by_id = su.user_id
|
||||||
<where>
|
<where>
|
||||||
|
@ -104,7 +104,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="checkUseApply" resultType="int">
|
<select id="checkUseApply" resultType="int">
|
||||||
SELECT count(*) FROM `t_use_apply_item` uai
|
SELECT count(*) FROM `t_use_apply_item` uai
|
||||||
left join `t_use_apply` ua on uai.apply_id = ua.id
|
left join `t_tool_apply` ua on uai.apply_id = ua.id
|
||||||
WHERE ua.record_status = 'done'
|
WHERE ua.record_status = 'done'
|
||||||
and uai.tool_id = #{toolId}
|
and uai.tool_id = #{toolId}
|
||||||
and ua.user_id = #{userId}
|
and ua.user_id = #{userId}
|
||||||
|
@ -182,6 +182,7 @@ public class Constants
|
|||||||
public static final String DOWNLOAD_TOOL_PERMISSION = "download:done:tool";
|
public static final String DOWNLOAD_TOOL_PERMISSION = "download:done:tool";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** 文档-状态-已发布 **/
|
/** 文档-状态-已发布 **/
|
||||||
public static final String DOC_STATUS_YFB = "yfb";
|
public static final String DOC_STATUS_YFB = "yfb";
|
||||||
/** 文档-状态-已上传 **/
|
/** 文档-状态-已上传 **/
|
||||||
@ -195,4 +196,7 @@ public class Constants
|
|||||||
|
|
||||||
public static final String STR_ZERO = "0";
|
public static final String STR_ZERO = "0";
|
||||||
public static final String STR_ONE = "1";
|
public static final String STR_ONE = "1";
|
||||||
|
|
||||||
|
public static final String DOC_DOWNLOAD_PERMISSION = "document:download";
|
||||||
|
public static final String DOC_VIEW_PERMISSION = "document:query:data:all";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user