|
|
@@ -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;
|
|
|
@@ -77,8 +78,8 @@ public class InquiryServiceImpl implements InquiryService {
|
|
|
if (StringUtils.hasText(filter.getKeyword())) {
|
|
|
SimpleExpression cmpCode = new SimpleExpression("cmpCode", filter.getKeyword(), CriterionExpression.Operator.LIKE);
|
|
|
SimpleExpression brand = new SimpleExpression("inbrand", filter.getKeyword(), CriterionExpression.Operator.LIKE);
|
|
|
- SimpleExpression code = new SimpleExpression("product.cmpCode", filter.getKeyword(), CriterionExpression.Operator.LIKE);
|
|
|
- SimpleExpression[] simpleExpressions = new SimpleExpression[]{cmpCode, brand, code};
|
|
|
+ //SimpleExpression code = new SimpleExpression("product.cmpCode", filter.getKeyword(), CriterionExpression.Operator.LIKE);
|
|
|
+ SimpleExpression[] simpleExpressions = new SimpleExpression[]{cmpCode, brand};
|
|
|
LogicalExpression logicalExpression = PredicateUtils.or(simpleExpressions);
|
|
|
info.expression(logicalExpression);
|
|
|
}
|
|
|
@@ -231,8 +232,27 @@ public class InquiryServiceImpl implements InquiryService {
|
|
|
Set<InquiryProductInfo> products = new HashSet<InquiryProductInfo>();
|
|
|
if (!CollectionUtils.isEmpty(inquiry.getInquiryItems())) {
|
|
|
for (PublicInquiryItem item : inquiry.getInquiryItems()) {
|
|
|
- idList.add(item.getProductId());
|
|
|
- ids.addAll(idList);
|
|
|
+ if (item.getProductId() != null) {
|
|
|
+ idList.add(item.getProductId());
|
|
|
+ ids.addAll(idList);
|
|
|
+ } else {
|
|
|
+ InquiryProductInfo productInfo = new InquiryProductInfo();
|
|
|
+ Set<PublicInquiryItem> items = new HashSet<PublicInquiryItem>();
|
|
|
+ productInfo.setBrand(item.getBrand());
|
|
|
+ productInfo.setSpec(item.getSpec());
|
|
|
+ productInfo.setCode(item.getProdCode());
|
|
|
+ productInfo.setTitle(item.getProdTitle());
|
|
|
+ productInfo.setUnit(item.getUnit());
|
|
|
+ productInfo.setCmpCode(item.getCmpCode());
|
|
|
+ products.add(productInfo);
|
|
|
+ for (PublicInquiryItem item1 : inquiry.getInquiryItems()) {
|
|
|
+ if (item1.getCmpCode() != null && item1.getCmpCode().equals(productInfo.getCmpCode())) {
|
|
|
+ items.add(item1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ productInfo.setInquiryItems(items);
|
|
|
+ inquiryInfo.setProducts(products);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(ids)) {
|
|
|
@@ -324,4 +344,54 @@ 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 inbrand = new SimpleExpression("inbrand", Constant.NO, CriterionExpression.Operator.GT);
|
|
|
+ SimpleExpression[] simpleExpressions = new SimpleExpression[]{inbrand, cmpCode};
|
|
|
+ LogicalExpression logicalExpression = PredicateUtils.or(simpleExpressions);
|
|
|
+ pageInfo.expression(logicalExpression);
|
|
|
+ }
|
|
|
+ if (filter.getFromDate() != null) {
|
|
|
+ pageInfo.expression(PredicateUtils.gte("date", new Date(filter.getFromDate()), false));
|
|
|
+ }
|
|
|
+ if (filter.getEndDate() != null) {
|
|
|
+ pageInfo.expression(PredicateUtils.lte("date", new Date(filter.getEndDate()), false));
|
|
|
+ }
|
|
|
+ pageInfo.expression(PredicateUtils.gt("offerAmount", Constant.NO, false));
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (null != itemInfo.getInquiry().getEndDate()) {
|
|
|
+ itemInfo.setRemainingTime(itemInfo.getInquiry().getEndDate().getTime() - System.currentTimeMillis());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return items;
|
|
|
+ }
|
|
|
}
|