feat:报告详情页下载权限判定
This commit is contained in:
@@ -14,7 +14,9 @@ import com.adc.da.report.vo.ReportDetailVo;
|
||||
import com.adc.da.report.vo.ReportQueryVo;
|
||||
import com.adc.da.report.vo.ReportVo;
|
||||
import com.adc.da.sys.dao.mysql.RoleEODao;
|
||||
import com.adc.da.sys.dao.mysql.UserEODao;
|
||||
import com.adc.da.sys.entity.RoleEO;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.CollectionUtils;
|
||||
@@ -31,6 +33,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -101,6 +104,16 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
@Resource
|
||||
private IPowerApplyService iPowerApplyService;
|
||||
|
||||
@Resource
|
||||
private IReportLogBookService reportLogBookService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private IReportUserRatingService reportUserRatingService;
|
||||
|
||||
@Resource
|
||||
private UserEODao userEODao;
|
||||
|
||||
|
||||
/**
|
||||
* 新增或编辑报告
|
||||
@@ -554,7 +567,26 @@ public class IReportServiceImpl extends ServiceImpl<ReportDao, ReportEntity>
|
||||
if (reportDetailVo.getCreateUserId().equals(UserUtils.getUserId())) {
|
||||
reportDetailVo.setDownPower(1);
|
||||
} else {
|
||||
//TODO 写对应的查询权限逻辑
|
||||
reportDetailVo.setDownPower(0);
|
||||
//查看申请权限表的权限
|
||||
LambdaQueryWrapper<PowerApply> powerApplyLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
powerApplyLambdaQueryWrapper.eq(PowerApply::getPower, 3);
|
||||
powerApplyLambdaQueryWrapper.eq(PowerApply::getPower, 2);
|
||||
List<PowerApply> list = iPowerApplyService.list(powerApplyLambdaQueryWrapper);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list.forEach(powerApply -> {
|
||||
if (powerApply.getUserId().equals(UserUtils.getUserId())) {
|
||||
reportDetailVo.setDownPower(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
UserEO userEo = userEODao.selectById(UserUtils.getUserId());
|
||||
String levelId = userEo.getLevelId() == null ? "1.0" : userEo.getLevelId();
|
||||
//用户级别
|
||||
double level = Double.parseDouble(levelId);
|
||||
if (level <= 0.5) {
|
||||
reportDetailVo.setDownPower(1);
|
||||
}
|
||||
}
|
||||
return Result.success(reportDetailVo);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user