|
@@ -122,7 +122,7 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
private SysFileRefService sysFileRefService;
|
|
|
|
|
|
@Override
|
|
|
- public List<PlanYearsResponseVo> selectPlanYearsListEXP(PlanYearsStandardVo vo) {
|
|
|
+ public List<PlanYearsResponseVo> selectPlanYearsListEXP(PlanYearsStandardVo vo, LoginUser loginUser) {
|
|
|
List<PlanYears> list = new ArrayList<>();
|
|
|
List<PlanYearsResponseVo> planYearsList = new ArrayList<>();
|
|
|
try {
|
|
@@ -149,6 +149,38 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
lw.le(PlanYears::getPlanDemandSubTime, vo.getEndTime());
|
|
|
}
|
|
|
lw.eq(PlanYears::getDelFlay, DataIsDelete.DataNOTDelete.getCode());
|
|
|
+ // 添加数据权限
|
|
|
+ List<String> roleKeys = loginUser.getUser().getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.toList());
|
|
|
+ if (roleKeys.contains(Constants.DEMAND_UNIT)) {
|
|
|
+ // 需求单位
|
|
|
+ /*(purchase_dept_id = 当前用户deptID) */
|
|
|
+ lw.eq(PlanYears::getPurchaseDeptId, loginUser.getDeptId());
|
|
|
+ } else if (roleKeys.contains(Constants.PURCHASING_MANAGEMENT)
|
|
|
+ || roleKeys.contains(Constants.PURCHASE_SERVICES)) {
|
|
|
+ // 采购管理部门 或 采购办
|
|
|
+ SysDept sysDept = new SysDept();
|
|
|
+ sysDept.setParentId(loginUser.getDeptId());
|
|
|
+ sysDept.setStatus("0");
|
|
|
+ List<Long> childDeptIds = deptService.selectDeptList(sysDept)
|
|
|
+ .stream()
|
|
|
+ .map(SysDept::getDeptId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ObjectUtils.isEmpty(childDeptIds)) {
|
|
|
+ lw.and((wrapper) -> {
|
|
|
+ wrapper.eq(PlanYears::getIsExcess, 0);
|
|
|
+ wrapper.eq(PlanYears::getPurchaseDeptId, loginUser.getDeptId());
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ lw.and((wrapper) -> {
|
|
|
+ wrapper.eq(PlanYears::getIsExcess, 0);
|
|
|
+ wrapper.eq(PlanYears::getPurchaseDeptId, loginUser.getDeptId());
|
|
|
+ })
|
|
|
+ .or((wrapper) -> {
|
|
|
+ wrapper.eq(PlanYears::getIsExcess, 1);
|
|
|
+ wrapper.in(PlanYears::getPurchaseDeptId, childDeptIds);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
Page<PlanYears> page = planYearsMapper.selectPage(new Page<PlanYears>(num, size, false), lw);
|
|
|
list.addAll(page.getRecords());
|
|
|
size = page.getRecords().size();
|
|
@@ -162,7 +194,7 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<PlanYearsResponseVo> selectPlanYearsExamineListEXP(PlanYearsStandardVo vo) {
|
|
|
+ public List<PlanYearsResponseVo> selectPlanYearsExamineListEXP(PlanYearsStandardVo vo, LoginUser loginUser) {
|
|
|
List<PlanYears> list = new ArrayList<>();
|
|
|
List<PlanYearsResponseVo> planYearsList = new ArrayList<>();
|
|
|
try {
|
|
@@ -191,6 +223,38 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
lw.le(PlanYears::getPlanDemandSubTime, vo.getEndTime());
|
|
|
}
|
|
|
lw.eq(PlanYears::getDelFlay, DataIsDelete.DataNOTDelete);
|
|
|
+ // 添加数据权限
|
|
|
+ List<String> roleKeys = loginUser.getUser().getRoles().stream().map(SysRole::getRoleKey).collect(Collectors.toList());
|
|
|
+ if (roleKeys.contains(Constants.DEMAND_UNIT)) {
|
|
|
+ // 需求单位
|
|
|
+ /*(purchase_dept_id = 当前用户deptID) */
|
|
|
+ lw.eq(PlanYears::getPurchaseDeptId, loginUser.getDeptId());
|
|
|
+ } else if (roleKeys.contains(Constants.PURCHASING_MANAGEMENT)
|
|
|
+ || roleKeys.contains(Constants.PURCHASE_SERVICES)) {
|
|
|
+ // 采购管理部门 或 采购办
|
|
|
+ SysDept sysDept = new SysDept();
|
|
|
+ sysDept.setParentId(loginUser.getDeptId());
|
|
|
+ sysDept.setStatus("0");
|
|
|
+ List<Long> childDeptIds = deptService.selectDeptList(sysDept)
|
|
|
+ .stream()
|
|
|
+ .map(SysDept::getDeptId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ObjectUtils.isEmpty(childDeptIds)) {
|
|
|
+ lw.and((wrapper) -> {
|
|
|
+ wrapper.eq(PlanYears::getIsExcess, 0);
|
|
|
+ wrapper.eq(PlanYears::getPurchaseDeptId, loginUser.getDeptId());
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ lw.and((wrapper) -> {
|
|
|
+ wrapper.eq(PlanYears::getIsExcess, 0);
|
|
|
+ wrapper.eq(PlanYears::getPurchaseDeptId, loginUser.getDeptId());
|
|
|
+ })
|
|
|
+ .or((wrapper) -> {
|
|
|
+ wrapper.eq(PlanYears::getIsExcess, 1);
|
|
|
+ wrapper.in(PlanYears::getPurchaseDeptId, childDeptIds);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
Page<PlanYears> page = planYearsMapper.selectPage(new Page<PlanYears>(num, size, false), lw);
|
|
|
list.addAll(page.getRecords());
|
|
|
size = page.getRecords().size();
|
|
@@ -850,6 +914,7 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
if (!ObjectUtils.isEmpty(demandRes) && demandRes.size() > 0) {
|
|
|
for (PmDemandResVo demandResVo : demandRes) {
|
|
|
HomeToDoQueryResVo home = new HomeToDoQueryResVo();
|
|
|
+ home.setEvaluation(BigDecimal.valueOf(demandResVo.getEvaluation()));
|
|
|
BeanUtils.copyProperties(demandResVo, home);
|
|
|
homeRes.add(home);
|
|
|
}
|
|
@@ -876,6 +941,7 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
|
|
|
if (!ObjectUtils.isEmpty(demandRes) && demandRes.size() > 0) {
|
|
|
for (PmDemandResVo demandResVo : demandRes) {
|
|
|
HomeToDoQueryResVo home = new HomeToDoQueryResVo();
|
|
|
+ home.setEvaluation(BigDecimal.valueOf(demandResVo.getEvaluation()));
|
|
|
BeanUtils.copyProperties(demandResVo, home);
|
|
|
homeRes.add(home);
|
|
|
}
|