@@ -137,7 +137,7 @@ public class NoticeManage { | |||||
.eq(req.getType() != null, Notice::getType, req.getType()) | .eq(req.getType() != null, Notice::getType, req.getType()) | ||||
.orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); | .orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); | ||||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | ||||
permissionsWrapper(wrapper,user); | |||||
permissionsWrapperByEdit(wrapper,user); | |||||
Page<Notice> page = noticeService.page(req.page(), wrapper); | Page<Notice> page = noticeService.page(req.page(), wrapper); | ||||
if (page.getTotal() == 0) { | if (page.getTotal() == 0) { | ||||
return PageVo.empty(); | return PageVo.empty(); | ||||
@@ -331,4 +331,14 @@ public class NoticeManage { | |||||
.or(q2 -> q2.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) | .or(q2 -> q2.eq(Notice::getPermissions,NoticePermissionsEnum.ORG.getCode()) | ||||
.eq(Notice::getPermissionsValue,user.getEmpPosUnitCode()))); | .eq(Notice::getPermissionsValue,user.getEmpPosUnitCode()))); | ||||
} | } | ||||
private void permissionsWrapperByEdit(LambdaQueryWrapper<Notice> wrapper,UserFullInfoDTO user) { | |||||
UserInfoDetails userInfoDetails = LoginUserUtil.loginUserDetail(); | |||||
//如果是超管 就能看所有 | |||||
if(user.getSuperAdmin()){ | |||||
log.info(user.getUsername() + ",超管可以看所有"); | |||||
}else{ | |||||
wrapper.eq(Notice::getCreateOn,user.getUserId()); | |||||
} | |||||
} | |||||
} | } |
@@ -104,4 +104,28 @@ public class UserFullInfoDTO { | |||||
} | } | ||||
return Boolean.FALSE; | return Boolean.FALSE; | ||||
} | } | ||||
public Boolean getSuperAdmin() { | |||||
if (CollUtil.isNotEmpty(this.userRoleList)) { | |||||
for (Role role : this.userRoleList) { | |||||
RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); | |||||
if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.SUPER_ADMIN.name())) { | |||||
return Boolean.TRUE; | |||||
} | |||||
} | |||||
} | |||||
return Boolean.FALSE; | |||||
} | |||||
public Boolean getRegionAdmin() { | |||||
if (CollUtil.isNotEmpty(this.userRoleList)) { | |||||
for (Role role : this.userRoleList) { | |||||
RoleEnum roleEnum = RoleEnum.mathByName(role.getCode()); | |||||
if (Objects.nonNull(roleEnum) && roleEnum.eq(RoleEnum.REGION_MANAGER.name())) { | |||||
return Boolean.TRUE; | |||||
} | |||||
} | |||||
} | |||||
return Boolean.FALSE; | |||||
} | |||||
} | } |
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.ningdatech.pmapi.AppTests; | import com.ningdatech.pmapi.AppTests; | ||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; | import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; | ||||
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; | import com.ningdatech.pmapi.gov.model.dto.GovBizProjectBaseinfoDTO; | ||||
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; | import com.ningdatech.pmapi.gov.model.dto.GovBizProjectSaveDTO; | ||||
@@ -52,14 +53,14 @@ public class ProjectCollectionTest extends AppTests { | |||||
@Test | @Test | ||||
public void test(){ | public void test(){ | ||||
List<String> baseProjIds = Lists.newArrayList("33112700020210100191"); | |||||
List<String> baseProjIds = Lists.newArrayList("33110000020230100061"); | |||||
for(String baseProjId : baseProjIds){ | for(String baseProjId : baseProjIds){ | ||||
GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | GovBizProjectBaseinfo baseinfo = baseinfoService.getOne(Wrappers.lambdaQuery(GovBizProjectBaseinfo.class) | ||||
.eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) | .eq(GovBizProjectBaseinfo::getBaseProjId, baseProjId) | ||||
.eq(GovBizProjectBaseinfo::getId,457)); | |||||
.last(BizConst.LIMIT_1)); | |||||
GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) | GovBizProjectApply apply = applyService.getOne(Wrappers.lambdaQuery(GovBizProjectApply.class) | ||||
.eq(GovBizProjectApply::getBaseProjId, baseProjId) | .eq(GovBizProjectApply::getBaseProjId, baseProjId) | ||||
.eq(GovBizProjectApply::getId,451)); | |||||
.last(BizConst.LIMIT_1)); | |||||
GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); | GovBizProjectSaveDTO saveDTO = new GovBizProjectSaveDTO(); | ||||
saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); | saveDTO.setApply(BeanUtil.copyProperties(apply, GovBizProjectApplyDTO.class)); | ||||