|
|
@@ -54,6 +54,7 @@ import com.hz.pm.api.projectlib.service.IProjectInstService; |
|
|
|
import com.hz.pm.api.projectlib.service.IProjectService; |
|
|
|
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService; |
|
|
|
import com.hz.pm.api.sys.manage.ProcessModelManage; |
|
|
|
import com.hz.pm.api.user.helper.MhUnitCache; |
|
|
|
import com.hz.pm.api.user.security.model.UserFullInfoDTO; |
|
|
|
import com.hz.pm.api.user.security.model.UserInfoDetails; |
|
|
|
import com.hz.pm.api.user.util.LoginUserUtil; |
|
|
@@ -101,6 +102,7 @@ import java.util.stream.Stream; |
|
|
|
@RequiredArgsConstructor |
|
|
|
public class PurchaseManage { |
|
|
|
|
|
|
|
private final MhUnitCache mhUnitCache; |
|
|
|
private final IProjectService projectService; |
|
|
|
private final UserInfoHelper userInfoHelper; |
|
|
|
private final IContractService contractService; |
|
|
@@ -471,10 +473,6 @@ public class PurchaseManage { |
|
|
|
|
|
|
|
private PageVo<PurchaseAdaptionListVO> queryData(PurchaseAdaptionListReq req) { |
|
|
|
LambdaQueryWrapper<Purchase> query = Wrappers.lambdaQuery(Purchase.class) |
|
|
|
.like(StrUtil.isNotBlank(req.getBidName()), Purchase::getBidName, req.getBidName()) |
|
|
|
.le(req.getCreateOnMax() != null, Purchase::getCreateOn, req.getCreateOnMax()) |
|
|
|
.ge(req.getCreateOnMin() != null, Purchase::getCreateOn, req.getCreateOnMin()) |
|
|
|
.eq(req.getStatus() != null, Purchase::getStatus, req.getStatus()) |
|
|
|
.eq(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode()) |
|
|
|
.notExists(ExistsSqlConst.PURCHASE_EXISTS_PROJECT |
|
|
|
+ "and np.stage = {0}", ProjectStatus.STOPPED.getCode()) |
|
|
@@ -483,6 +481,17 @@ public class PurchaseManage { |
|
|
|
if (!purchaseService.buildPurchaseQueryPermission(query, user)) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
if (req.hasProjectQuery()) { |
|
|
|
List<Long> projectIds = filterProjectIdsForPurchase(req); |
|
|
|
if (projectIds.isEmpty()) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
query.in(Purchase::getProjectId, projectIds); |
|
|
|
} |
|
|
|
query.like(StrUtil.isNotBlank(req.getBidName()), Purchase::getBidName, req.getBidName()) |
|
|
|
.le(req.getCreateOnMax() != null, Purchase::getCreateOn, req.getCreateOnMax()) |
|
|
|
.ge(req.getCreateOnMin() != null, Purchase::getCreateOn, req.getCreateOnMin()) |
|
|
|
.eq(req.getStatus() != null, Purchase::getStatus, req.getStatus()); |
|
|
|
Page<Purchase> page = purchaseService.page(req.page(), query); |
|
|
|
if (page.getTotal() == 0) { |
|
|
|
return PageVo.empty(); |
|
|
@@ -514,6 +523,19 @@ public class PurchaseManage { |
|
|
|
return PageVo.of(data, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
private List<Long> filterProjectIdsForPurchase(PurchaseAdaptionListReq req) { |
|
|
|
LambdaQueryWrapper<Project> projQuery = Wrappers.lambdaQuery(Project.class) |
|
|
|
.select(Project::getId) |
|
|
|
.ne(Project::getStage, ProjectStatus.STOPPED.getCode()) |
|
|
|
.eq(Project::getNewest, Boolean.TRUE) |
|
|
|
.like(StrUtil.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName()) |
|
|
|
.like(StrUtil.isNotBlank(req.getBuildOrgName()), Project::getBuildOrgName, req.getBuildOrgName()) |
|
|
|
.in(req.getBuildOrgCode() != null, Project::getBuildOrgCode, |
|
|
|
mhUnitCache.getViewChildIdsRecursion(req.getBuildOrgCode())); |
|
|
|
List<Project> projects = projectService.list(projQuery); |
|
|
|
return CollUtils.fieldList(projects, Project::getId); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PageVo<PurchaseAdaptionListVO> adaptList(PurchaseAdaptionListReq req) { |
|
|
|
return queryData(req); |
|
|
|