1、调整需求的listNoPermission接口
This commit is contained in:
@@ -1807,11 +1807,17 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
|||||||
@Override
|
@Override
|
||||||
public SdmResponse listNoPermission(SpdmDemandListReq req) {
|
public SdmResponse listNoPermission(SpdmDemandListReq req) {
|
||||||
Long tenantId = ThreadLocalContext.getTenantId();
|
Long tenantId = ThreadLocalContext.getTenantId();
|
||||||
|
String jobNumber = removeLeadingZeros(ThreadLocalContext.getJobNumber());
|
||||||
|
Long currentUserId = ThreadLocalContext.getUserId();
|
||||||
|
if (ObjectUtils.isEmpty(tenantId) || ObjectUtils.isEmpty(jobNumber)) {
|
||||||
|
log.error("公司和工号都不能为空");
|
||||||
|
return SdmResponse.failed("公司和工号都不能为空");
|
||||||
|
}
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("data", new ArrayList<>());
|
jsonObject.put("data", new ArrayList<>());
|
||||||
List<SpdmDemandVo> demandList = mapper.getDemandListNoPermission(tenantId,req);
|
List<SpdmDemandVo> demandList = mapper.getDemandList(tenantId, req);
|
||||||
if (CollectionUtils.isEmpty(demandList)) {
|
if (CollectionUtils.isEmpty(demandList)) {
|
||||||
log.error("未查询到需求");
|
log.error("根据tenantId:{},未查询到需求", tenantId);
|
||||||
return SdmResponse.success(jsonObject);
|
return SdmResponse.success(jsonObject);
|
||||||
}
|
}
|
||||||
// 0:我发起的 1:我确认的
|
// 0:我发起的 1:我确认的
|
||||||
@@ -1821,6 +1827,27 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
|||||||
return SdmResponse.success(jsonObject);
|
return SdmResponse.success(jsonObject);
|
||||||
}
|
}
|
||||||
List<SpdmDemandMemberVo> demandMemberVoList = mapper.getMemberList(demandList.stream().map(SpdmDemandVo::getUuid).toList(), null);
|
List<SpdmDemandMemberVo> demandMemberVoList = mapper.getMemberList(demandList.stream().map(SpdmDemandVo::getUuid).toList(), null);
|
||||||
|
if (CollectionUtils.isEmpty(demandMemberVoList)) {
|
||||||
|
log.error("demandList0为空");
|
||||||
|
return SdmResponse.success(jsonObject);
|
||||||
|
}
|
||||||
|
if (type == 0) {
|
||||||
|
// 创建人是当前用户
|
||||||
|
demandList = demandList.stream().filter(demand -> jobNumber.equals(String.valueOf(demand.getCreator())) || currentUserId.equals(demand.getCreator())).toList();
|
||||||
|
} else {
|
||||||
|
// 仿真负责人是当前用户
|
||||||
|
List<SpdmDemandMemberVo> pDemandMemberVoList = demandMemberVoList.stream().filter(member -> MemberTypeEnum.PRINCIPAL.getCode().equals(member.getType()) && currentUserId.equals(member.getUserId())).toList();
|
||||||
|
if (CollectionUtils.isNotEmpty(pDemandMemberVoList)) {
|
||||||
|
List<String> myDemandIdList = pDemandMemberVoList.stream().map(SpdmDemandMemberVo::getDemandId).toList();
|
||||||
|
demandList = demandList.stream().filter(demand -> myDemandIdList.contains(demand.getUuid())).toList();
|
||||||
|
}else {
|
||||||
|
return SdmResponse.success(jsonObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtils.isEmpty(demandList)) {
|
||||||
|
log.error("demandList1为空");
|
||||||
|
return SdmResponse.success(jsonObject);
|
||||||
|
}
|
||||||
List<SpdmTaskVo> taskList = taskMapper.getTaskListByDemandIdList(demandList.stream().map(SpdmDemandVo::getUuid).toList());
|
List<SpdmTaskVo> taskList = taskMapper.getTaskListByDemandIdList(demandList.stream().map(SpdmDemandVo::getUuid).toList());
|
||||||
Map<String, List<SpdmTaskVo>> taskMap = Map.of();
|
Map<String, List<SpdmTaskVo>> taskMap = Map.of();
|
||||||
if (CollectionUtils.isNotEmpty(taskList)) {
|
if (CollectionUtils.isNotEmpty(taskList)) {
|
||||||
@@ -2005,10 +2032,7 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
|||||||
nodeMap = nodeList.stream().collect(Collectors.groupingBy(SpdmNodeVo::getUuid));
|
nodeMap = nodeList.stream().collect(Collectors.groupingBy(SpdmNodeVo::getUuid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Long> userIdList = new ArrayList<>();
|
List<Long> userIdList = demandMemberVoList.stream().map(SpdmDemandMemberVo::getUserId).toList();
|
||||||
if (CollectionUtils.isNotEmpty(demandMemberVoList)) {
|
|
||||||
userIdList = demandMemberVoList.stream().map(SpdmDemandMemberVo::getUserId).toList();
|
|
||||||
}
|
|
||||||
Map<Long, List<CIDUserResp>> userMap = Map.of();
|
Map<Long, List<CIDUserResp>> userMap = Map.of();
|
||||||
if (CollectionUtils.isNotEmpty(userIdList)) {
|
if (CollectionUtils.isNotEmpty(userIdList)) {
|
||||||
SdmResponse<List<CIDUserResp>> cidUserResp = sysUserFeignClient.listUserByIds(UserQueryReq.builder().userIds(userIdList).build());
|
SdmResponse<List<CIDUserResp>> cidUserResp = sysUserFeignClient.listUserByIds(UserQueryReq.builder().userIds(userIdList).build());
|
||||||
@@ -2041,7 +2065,7 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
|||||||
}
|
}
|
||||||
if (StringUtils.isNotBlank(spdmDemandVo.getWorkspaceId())) {
|
if (StringUtils.isNotBlank(spdmDemandVo.getWorkspaceId())) {
|
||||||
spdmDemandVo.setWorkspaceName(CollectionUtils.isNotEmpty(nodeMap.get(spdmDemandVo.getWorkspaceId())) ? nodeMap.get(spdmDemandVo.getWorkspaceId()).get(0).getNodeName() : "");
|
spdmDemandVo.setWorkspaceName(CollectionUtils.isNotEmpty(nodeMap.get(spdmDemandVo.getWorkspaceId())) ? nodeMap.get(spdmDemandVo.getWorkspaceId()).get(0).getNodeName() : "");
|
||||||
spdmDemandVo.setWorkspaceCode(CollectionUtils.isNotEmpty(nodeMap.get(spdmDemandVo.getWorkspaceId())) ? nodeMap.get(spdmDemandVo.getWorkspaceId()).get(0).getNodeCode() : "");
|
spdmDemandVo.setWorkspaceCode((CollectionUtils.isNotEmpty(nodeMap.get(spdmDemandVo.getWorkspaceId())) ? nodeMap.get(spdmDemandVo.getWorkspaceId()).get(0).getNodeCode() : ""));
|
||||||
}
|
}
|
||||||
eachDemandMemberList = demandMemberMap.get(spdmDemandVo.getUuid());
|
eachDemandMemberList = demandMemberMap.get(spdmDemandVo.getUuid());
|
||||||
if (CollectionUtils.isEmpty(eachDemandMemberList)) {
|
if (CollectionUtils.isEmpty(eachDemandMemberList)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user