|
@@ -24,7 +24,6 @@ import com.hz.pm.api.projectlib.service.IProjectService; |
|
|
import com.hz.pm.api.user.helper.MhUnitCache; |
|
|
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.UserFullInfoDTO; |
|
|
import com.hz.pm.api.user.util.LoginUserUtil; |
|
|
import com.hz.pm.api.user.util.LoginUserUtil; |
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
import com.ningdatech.basic.util.CollUtils; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
@@ -36,7 +35,7 @@ import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* <p> |
|
|
* <p> |
|
|
* 服务实现类 |
|
|
|
|
|
|
|
|
* 服务实现类 |
|
|
* </p> |
|
|
* </p> |
|
|
* |
|
|
* |
|
|
* @author zpf |
|
|
* @author zpf |
|
@@ -63,12 +62,12 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> |
|
|
.le(req.getCreateOnMax() != null, Purchase::getCreateOn, req.getCreateOnMax()) |
|
|
.le(req.getCreateOnMax() != null, Purchase::getCreateOn, req.getCreateOnMax()) |
|
|
.ge(req.getCreateOnMin() != null, Purchase::getCreateOn, req.getCreateOnMin()) |
|
|
.ge(req.getCreateOnMin() != null, Purchase::getCreateOn, req.getCreateOnMin()) |
|
|
.eq(req.getStatus() != null, Purchase::getXcfhxApplyStatus, req.getStatus()) |
|
|
.eq(req.getStatus() != null, Purchase::getXcfhxApplyStatus, req.getStatus()) |
|
|
.eq(req.getSourceType() != null,Purchase::getSourceType,req.getSourceType()) |
|
|
|
|
|
|
|
|
.eq(req.getSourceType() != null, Purchase::getSourceType, req.getSourceType()) |
|
|
.orderByDesc(Purchase::getCreateOn); |
|
|
.orderByDesc(Purchase::getCreateOn); |
|
|
|
|
|
|
|
|
if (Boolean.TRUE.equals(req.getFinished())) { |
|
|
if (Boolean.TRUE.equals(req.getFinished())) { |
|
|
query.eq(Purchase::getXcfhxApplyStatus, TenderXcfhxApplyStatus.XCFHX_APPLY_PASSED.getCode()); |
|
|
query.eq(Purchase::getXcfhxApplyStatus, TenderXcfhxApplyStatus.XCFHX_APPLY_PASSED.getCode()); |
|
|
} else if (Boolean.FALSE.equals(req.getFinished())){ |
|
|
|
|
|
|
|
|
} else if (Boolean.FALSE.equals(req.getFinished())) { |
|
|
query.ne(Purchase::getXcfhxApplyStatus, TenderXcfhxApplyStatus.XCFHX_APPLY_PASSED.getCode()); |
|
|
query.ne(Purchase::getXcfhxApplyStatus, TenderXcfhxApplyStatus.XCFHX_APPLY_PASSED.getCode()); |
|
|
} |
|
|
} |
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
|
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); |
|
@@ -80,8 +79,8 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> |
|
|
if (CollUtil.isNotEmpty(purchases)) { |
|
|
if (CollUtil.isNotEmpty(purchases)) { |
|
|
Set<Long> projectIds = CollUtils.fieldSet(purchases, Purchase::getProjectId); |
|
|
Set<Long> projectIds = CollUtils.fieldSet(purchases, Purchase::getProjectId); |
|
|
List<Project> projects = projectIds.isEmpty() ? Lists.newArrayList() : projectService.list(Wrappers.lambdaQuery(Project.class) |
|
|
List<Project> projects = projectIds.isEmpty() ? Lists.newArrayList() : projectService.list(Wrappers.lambdaQuery(Project.class) |
|
|
.in(Project::getId,projectIds) |
|
|
|
|
|
.like(StringUtils.isNotBlank(req.getProjectName()),Project::getProjectName,req.getProjectName())); |
|
|
|
|
|
|
|
|
.in(Project::getId, projectIds) |
|
|
|
|
|
.like(StringUtils.isNotBlank(req.getProjectName()), Project::getProjectName, req.getProjectName())); |
|
|
Map<Long, Project> projectMap = CollUtils.listToMap(projects, Project::getId); |
|
|
Map<Long, Project> projectMap = CollUtils.listToMap(projects, Project::getId); |
|
|
Map<Long, Contract> contractMap = projectIds.isEmpty() ? Maps.newHashMap() |
|
|
Map<Long, Contract> contractMap = projectIds.isEmpty() ? Maps.newHashMap() |
|
|
: contractService.listByProjectIds(projectIds); |
|
|
: contractService.listByProjectIds(projectIds); |
|
@@ -103,17 +102,17 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> |
|
|
|
|
|
|
|
|
Contract contract = contractMap.get(w.getId()); |
|
|
Contract contract = contractMap.get(w.getId()); |
|
|
if (contract != null) { |
|
|
if (contract != null) { |
|
|
if(Objects.nonNull(req.getAmountStart()) && Objects.nonNull(contract.getTotalAmount()) |
|
|
|
|
|
&& req.getAmountStart().compareTo(contract.getTotalAmount()) > 0){ |
|
|
|
|
|
|
|
|
if (Objects.nonNull(req.getAmountStart()) && Objects.nonNull(contract.getTotalAmount()) |
|
|
|
|
|
&& req.getAmountStart().compareTo(contract.getTotalAmount()) > 0) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
if(Objects.nonNull(req.getAmountEnd()) && Objects.nonNull(contract.getTotalAmount()) |
|
|
|
|
|
&& req.getAmountEnd().compareTo(contract.getTotalAmount()) < 0){ |
|
|
|
|
|
|
|
|
if (Objects.nonNull(req.getAmountEnd()) && Objects.nonNull(contract.getTotalAmount()) |
|
|
|
|
|
&& req.getAmountEnd().compareTo(contract.getTotalAmount()) < 0) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
item.setContractAmount(contract.getTotalAmount()); |
|
|
item.setContractAmount(contract.getTotalAmount()); |
|
|
}else{ |
|
|
|
|
|
if(Objects.nonNull(req.getAmountStart()) || Objects.nonNull(req.getAmountEnd())){ |
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
if (Objects.nonNull(req.getAmountStart()) || Objects.nonNull(req.getAmountEnd())) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@@ -123,6 +122,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> |
|
|
return others; |
|
|
return others; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
public boolean buildPurchaseQueryPermission(LambdaQueryWrapper<Purchase> query, UserFullInfoDTO user) { |
|
|
public boolean buildPurchaseQueryPermission(LambdaQueryWrapper<Purchase> query, UserFullInfoDTO user) { |
|
|
boolean queryState = true; |
|
|
boolean queryState = true; |
|
|
Optional<DataScopeDTO> datascope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); |
|
|
Optional<DataScopeDTO> datascope = DataScopeUtil.getCurrentUserDataScopeHasUserId(user); |
|
|