|
|
@@ -4,6 +4,7 @@ import com.uas.ps.core.util.CollectionUtils;
|
|
|
import com.uas.ps.entity.Product;
|
|
|
import com.uas.ps.entity.Status;
|
|
|
import com.uas.ps.inquiry.dao.*;
|
|
|
+import com.uas.ps.inquiry.domain.IPage;
|
|
|
import com.uas.ps.inquiry.entity.Constant;
|
|
|
import com.uas.ps.inquiry.entity.InquiryDetailInfo;
|
|
|
import com.uas.ps.inquiry.entity.InquiryProductInfo;
|
|
|
@@ -343,4 +344,49 @@ public class InquiryServiceImpl implements InquiryService {
|
|
|
}
|
|
|
return productInfo;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 针对客户查询供应商报价信息
|
|
|
+ *
|
|
|
+ * @param pageInfo 分页信息
|
|
|
+ * @param filter 过滤条件
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<PurcInquiryItemInfo> findQuotationsByPage(final PageInfo pageInfo, final SearchFilter filter) {
|
|
|
+ if (StringUtils.hasText(filter.getKeyword())) {
|
|
|
+ SimpleExpression cmpCode = new SimpleExpression("cmpCode", filter.getKeyword(), CriterionExpression.Operator.LIKE);
|
|
|
+ SimpleExpression offerAmount = new SimpleExpression("offerAmount", Constant.NO, CriterionExpression.Operator.GT);
|
|
|
+ SimpleExpression[] simpleExpressions = new SimpleExpression[]{offerAmount, cmpCode};
|
|
|
+ LogicalExpression logicalExpression = PredicateUtils.and(simpleExpressions);
|
|
|
+ pageInfo.expression(logicalExpression);
|
|
|
+ } else {
|
|
|
+ SimpleExpression offerAmount = new SimpleExpression("offerAmount", Constant.NO, CriterionExpression.Operator.GT);
|
|
|
+ SimpleExpression[] simpleExpressions = new SimpleExpression[]{offerAmount};
|
|
|
+ LogicalExpression logicalExpression = PredicateUtils.and(simpleExpressions);
|
|
|
+ pageInfo.expression(logicalExpression);
|
|
|
+ }
|
|
|
+ Page<PurcInquiryItemInfo> items = inquiryItemDao.findAll(new Specification<PurcInquiryItemInfo>() {
|
|
|
+ public Predicate toPredicate(Root<PurcInquiryItemInfo> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
|
|
|
+ query.where(pageInfo.getPredicates(root, query, builder));
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }, pageInfo);
|
|
|
+ if (!CollectionUtils.isEmpty(items.getContent())) {
|
|
|
+ for (PurcInquiryItemInfo itemInfo : items.getContent()) {
|
|
|
+ List<PublicInquiryItem> itemList = itemDao.findBySourceId(itemInfo.getId());
|
|
|
+ itemInfo.setQutations(itemList);
|
|
|
+ itemInfo.setAgreed(Constant.NO);
|
|
|
+ if (!CollectionUtils.isEmpty(itemList)) {
|
|
|
+ for (PublicInquiryItem i : itemList) {
|
|
|
+ if (i.getAgreed() != null && i.getAgreed().equals(Constant.YES)) {
|
|
|
+ itemInfo.setAgreed(Constant.YES);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return items;
|
|
|
+ }
|
|
|
}
|