update
This commit is contained in:
parent
6c53e4c9ae
commit
045d857ae2
@ -73,18 +73,10 @@ public class ToolController extends BaseController
|
|||||||
for (Tool vo : list) {
|
for (Tool vo : list) {
|
||||||
//创建人、下载权限、系统管理员
|
//创建人、下载权限、系统管理员
|
||||||
//1.已经审核通过、并且有下载权限
|
//1.已经审核通过、并且有下载权限
|
||||||
vo.setDownloadStatus(
|
vo.setDownloadStatus(toolService.isDownloadStatus(userId, vo));
|
||||||
userId.equals(vo.getCreateBy())||
|
|
||||||
SysUser.isAdmin(SecurityUtils.getUserId()) ||
|
|
||||||
SecurityUtils.hasPermi(Constants.DOWNLOAD_TOOL_PERMISSION) ||
|
|
||||||
( RecordStatusEnum.DONE.getCode().equals(vo.getRecordStatus())&&
|
|
||||||
iToolApplyService.checkToolApply(vo.getToolId(),userId)));
|
|
||||||
|
|
||||||
ToolApply toolApply = new ToolApply();
|
// 是否已发起使用申请
|
||||||
toolApply.setToolId(vo.getToolId());
|
vo.setIsHasApplyUse(iToolApplyService.hasToolUseApply(vo.getToolId(), userId));
|
||||||
toolApply.setUserId(userId);
|
|
||||||
List<ToolApply> hasApplyUsToolApplyList = iToolApplyService.selectToolApplyList(toolApply);
|
|
||||||
vo.setIsHasApplyUse(hasApplyUsToolApplyList.size() > 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
@ -123,7 +115,10 @@ public class ToolController extends BaseController
|
|||||||
@GetMapping(value = "/{toolId}")
|
@GetMapping(value = "/{toolId}")
|
||||||
public AjaxResult getInfo(@PathVariable("toolId") String toolId)
|
public AjaxResult getInfo(@PathVariable("toolId") String toolId)
|
||||||
{
|
{
|
||||||
return success(toolService.selectToolByToolId(toolId));
|
Tool tool = toolService.selectToolByToolId(toolId);
|
||||||
|
String userId = SecurityUtils.getUserId().toString();
|
||||||
|
tool.setDownloadStatus(toolService.isDownloadStatus(userId, tool));
|
||||||
|
return success(tool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -237,4 +232,5 @@ public class ToolController extends BaseController
|
|||||||
{
|
{
|
||||||
return AjaxResult.success(toolService.statistics());
|
return AjaxResult.success(toolService.statistics());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -63,5 +63,7 @@ public interface ToolApplyMapper
|
|||||||
*/
|
*/
|
||||||
public int deleteToolApplyByIds(String[] ids);
|
public int deleteToolApplyByIds(String[] ids);
|
||||||
|
|
||||||
int checkToolApply(@Param("toolId") String toolId, @Param("userId") String userId);
|
int hasToolUseApply(@Param("toolId") String toolId, @Param("userId") String userId);
|
||||||
|
|
||||||
|
int checkToolUseApply(@Param("toolId") String toolId, @Param("userId") String userId);
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,9 @@ public interface IToolApplyService
|
|||||||
*/
|
*/
|
||||||
public int deleteToolApplyById(String id);
|
public int deleteToolApplyById(String id);
|
||||||
|
|
||||||
boolean checkToolApply(String toolId, String userId);
|
boolean hasToolUseApply(String toolId, String userId);
|
||||||
|
|
||||||
|
boolean checkToolUseApply(String toolId, String userId);
|
||||||
|
|
||||||
void sendTzMessage(ToolApply toolApply);
|
void sendTzMessage(ToolApply toolApply);
|
||||||
}
|
}
|
||||||
|
@ -98,4 +98,6 @@ public interface IToolService
|
|||||||
Map<String, Object> statistics();
|
Map<String, Object> statistics();
|
||||||
|
|
||||||
List<Tool> selectAllList(Tool tool);
|
List<Tool> selectAllList(Tool tool);
|
||||||
|
|
||||||
|
boolean isDownloadStatus(String userId, Tool tool);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.lang.Snowflake;
|
import cn.hutool.core.lang.Snowflake;
|
||||||
import cn.hutool.core.util.BooleanUtil;
|
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.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.rzdata.common.annotation.DataScope;
|
import com.rzdata.common.annotation.DataScope;
|
||||||
import com.rzdata.common.constant.Constants;
|
import com.rzdata.common.constant.Constants;
|
||||||
@ -93,6 +92,8 @@ public class DocumentServiceImpl implements IDocumentService
|
|||||||
if(CollUtil.isNotEmpty(attachments)){
|
if(CollUtil.isNotEmpty(attachments)){
|
||||||
document.setAttachment(attachments.get(0));
|
document.setAttachment(attachments.get(0));
|
||||||
}
|
}
|
||||||
|
String userId = SecurityUtils.getUserId().toString();
|
||||||
|
document.setDownloadStatus(isDownloadStatus(userId, document));
|
||||||
return document;
|
return document;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,19 +137,23 @@ public class DocumentServiceImpl implements IDocumentService
|
|||||||
if (BooleanUtil.isTrue(document.getDownloadCheck())) {
|
if (BooleanUtil.isTrue(document.getDownloadCheck())) {
|
||||||
String userId = SecurityUtils.getUserId().toString();
|
String userId = SecurityUtils.getUserId().toString();
|
||||||
for (Document dc: documents) {
|
for (Document dc: documents) {
|
||||||
//文档中 是创建人 或者 配置了下载权限
|
dc.setDownloadStatus(isDownloadStatus(userId, dc));
|
||||||
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.checkToolApply(dc.getToolId(),userId)){
|
|
||||||
downStatus = true;
|
|
||||||
}
|
|
||||||
dc.setDownloadStatus(downStatus);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return documents;
|
return documents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isDownloadStatus(String userId, Document dc){
|
||||||
|
//文档中 是创建人 或者 配置了下载权限
|
||||||
|
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.checkToolUseApply(dc.getToolId(), userId)){
|
||||||
|
downStatus = true;
|
||||||
|
}
|
||||||
|
return downStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】列表
|
* 查询【请填写功能名称】列表
|
||||||
|
@ -129,8 +129,14 @@ public class ToolApplyServiceImpl implements IToolApplyService
|
|||||||
return toolApplyMapper.deleteToolApplyById(id);
|
return toolApplyMapper.deleteToolApplyById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkToolApply(String toolId, String userId){
|
@Override
|
||||||
return toolApplyMapper.checkToolApply(toolId, userId)>0;
|
public boolean checkToolUseApply(String toolId, String userId){
|
||||||
|
return toolApplyMapper.checkToolUseApply(toolId, userId)>0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasToolUseApply(String toolId, String userId){
|
||||||
|
return toolApplyMapper.hasToolUseApply(toolId, userId) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,6 +12,7 @@ import com.rzdata.common.constant.Constants;
|
|||||||
import com.rzdata.common.core.domain.entity.SysDept;
|
import com.rzdata.common.core.domain.entity.SysDept;
|
||||||
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.entity.SysUser;
|
||||||
|
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.ISysDeptService;
|
import com.rzdata.system.service.ISysDeptService;
|
||||||
@ -72,6 +73,9 @@ public class ToolServiceImpl implements IToolService
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IToolRelationService iToolRelationService;
|
private IToolRelationService iToolRelationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IToolApplyService iToolApplyService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询工具信息
|
* 查询工具信息
|
||||||
*
|
*
|
||||||
@ -454,4 +458,15 @@ public class ToolServiceImpl implements IToolService
|
|||||||
}
|
}
|
||||||
return tools;
|
return tools;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDownloadStatus(String userId, Tool tool){
|
||||||
|
//创建人、下载权限、系统管理员
|
||||||
|
//1.已经审核通过、并且有下载权限
|
||||||
|
return userId.equals(tool.getCreateBy()) ||
|
||||||
|
SysUser.isAdmin(SecurityUtils.getUserId()) ||
|
||||||
|
SecurityUtils.hasPermi(Constants.DOWNLOAD_TOOL_PERMISSION) ||
|
||||||
|
( RecordStatusEnum.DONE.getCode().equals(tool.getRecordStatus())&&
|
||||||
|
iToolApplyService.checkToolUseApply(tool.getToolId(), userId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,11 +129,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="checkToolApply" resultType="int">
|
<select id="hasToolUseApply" resultType="int">
|
||||||
SELECT count(*) FROM `t_use_apply_item` uai
|
SELECT count(*) FROM t_tool_apply ta
|
||||||
left join `t_tool_apply` ua on uai.apply_id = ua.id
|
WHERE ta.apply_type='use' and ta.tool_id = #{toolId} and ta.user_id = #{userId}
|
||||||
WHERE ua.record_status = 'done'
|
</select>
|
||||||
and uai.tool_id = #{toolId}
|
|
||||||
and ua.user_id = #{userId}
|
<select id="checkToolUseApply" resultType="int">
|
||||||
|
SELECT count(*) FROM t_tool_apply ta
|
||||||
|
WHERE ta.apply_type='use' and ta.record_status = 'done'
|
||||||
|
and ta.tool_id = #{toolId}
|
||||||
|
and ta.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user