|
|
@@ -32,10 +32,7 @@ import org.springframework.ui.ModelMap;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
-import javax.persistence.criteria.CriteriaBuilder;
|
|
|
-import javax.persistence.criteria.CriteriaQuery;
|
|
|
-import javax.persistence.criteria.Predicate;
|
|
|
-import javax.persistence.criteria.Root;
|
|
|
+import javax.persistence.criteria.*;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
|
@@ -248,15 +245,15 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
public List<PurcInquiry> covert(List<BatchInquiry> inquiries, Long enuu, String address) throws NotFoundException {
|
|
|
List<PurcInquiry> purcInquiries = new ArrayList<PurcInquiry>();
|
|
|
if (!CollectionUtils.isEmpty(inquiries)) {
|
|
|
- for(BatchInquiry inquiry : inquiries) {
|
|
|
+ for (BatchInquiry inquiry : inquiries) {
|
|
|
PurcInquiry old = purcInquiryDao.findByCodeAndEnUU(inquiry.getBi_code(), enuu);
|
|
|
//先判断是否已经存在,不存在才进行存储
|
|
|
- if(null == old) {
|
|
|
+ if (null == old) {
|
|
|
PurcInquiry purcInquiry = inquiry.covert();
|
|
|
purcInquiry.setEnUU(enuu);
|
|
|
purcInquiry.setShip(address);
|
|
|
Set<PurcInquiryItem> purcInquiryItems = new HashSet<PurcInquiryItem>();
|
|
|
- if(!CollectionUtils.isEmpty(inquiry.getInProducts())) {
|
|
|
+ if (!CollectionUtils.isEmpty(inquiry.getInProducts())) {
|
|
|
for(BatchInProduct batch : inquiry.getInProducts()) {
|
|
|
PurcInquiryItem item = new PurcInquiryItem();
|
|
|
item.setIsOpen(Constant.YES);
|
|
|
@@ -284,12 +281,12 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
item.setUserTel(batch.getBip_mobile());
|
|
|
item.setUserCode(batch.getBip_buyercode());
|
|
|
item.setOfferAmount(0);
|
|
|
- if(null != inquiry.getBi_date()) {
|
|
|
+ if (null != inquiry.getBi_date()) {
|
|
|
item.setDate(inquiry.getBi_date());
|
|
|
} else {
|
|
|
- item.setDate(new Date());
|
|
|
+ item.setDate(new Date(System.currentTimeMillis()));
|
|
|
}
|
|
|
- if(item.getCurrency() == null) {
|
|
|
+ if (item.getCurrency() == null) {
|
|
|
item.setCurrency("RMB");
|
|
|
}
|
|
|
purcInquiryItems.add(item);
|
|
|
@@ -645,14 +642,13 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
@Override
|
|
|
public Page<PublicInquiryItemInfo> findByPageInfo(final PageInfo info, final SearchFilter filter) {
|
|
|
if (null != filter) {
|
|
|
- int k = 0;
|
|
|
- SimpleExpression[] simpArrs = new SimpleExpression[4];
|
|
|
if (StringUtils.hasText(filter.getKeyword())) {
|
|
|
- simpArrs[k] = new SimpleExpression("product.title", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
- simpArrs[k + 1] = new SimpleExpression("product.code", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
- simpArrs[k + 2] = new SimpleExpression("product.spec", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
- simpArrs[k + 3] = new SimpleExpression("product.brand", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
- LogicalExpression logical = new LogicalExpression(simpArrs, CriterionExpression.Operator.OR);
|
|
|
+ SimpleExpression title = new SimpleExpression("product.title", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
+ SimpleExpression code = new SimpleExpression("product.code", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
+ SimpleExpression spec = new SimpleExpression("product.spec", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
+ SimpleExpression brand = new SimpleExpression("product.brand", filter.getKeyword(), CriterionExpression.Operator.LIKE, true);
|
|
|
+ SimpleExpression[] simpleExpressions = new SimpleExpression[]{title, brand, code, spec};
|
|
|
+ LogicalExpression logical = new LogicalExpression(simpleExpressions, CriterionExpression.Operator.OR);
|
|
|
info.expression(logical);
|
|
|
}
|
|
|
if (filter.getFromDate() != null) {
|
|
|
@@ -692,7 +688,7 @@ public class PublicInquiryServiceImpl implements PublicInquiryService {
|
|
|
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, code, brand};
|
|
|
+ SimpleExpression[] simpleExpressions = new SimpleExpression[]{cmpCode, brand, code};
|
|
|
LogicalExpression logicalExpression = PredicateUtils.or(simpleExpressions);
|
|
|
info.expression(logicalExpression);
|
|
|
}
|