|
@@ -1,36 +1,12 @@
|
|
|
package com.uas.platform.b2b.service.impl;
|
|
package com.uas.platform.b2b.service.impl;
|
|
|
|
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
-import java.util.Date;
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-
|
|
|
|
|
-import javax.persistence.criteria.CriteriaBuilder;
|
|
|
|
|
-import javax.persistence.criteria.CriteriaQuery;
|
|
|
|
|
-import javax.persistence.criteria.Predicate;
|
|
|
|
|
-import javax.persistence.criteria.Root;
|
|
|
|
|
-
|
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
|
|
-import org.springframework.data.jpa.domain.Specification;
|
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
|
-
|
|
|
|
|
import com.uas.platform.b2b.core.util.ContextUtils;
|
|
import com.uas.platform.b2b.core.util.ContextUtils;
|
|
|
-import com.uas.platform.b2b.dao.CommonDao;
|
|
|
|
|
-import com.uas.platform.b2b.dao.PagingReleaseCountDao;
|
|
|
|
|
-import com.uas.platform.b2b.dao.SaleQuotationAllDao;
|
|
|
|
|
-import com.uas.platform.b2b.dao.SaleQuotationDao;
|
|
|
|
|
-import com.uas.platform.b2b.dao.SaleQuotationDoneDao;
|
|
|
|
|
-import com.uas.platform.b2b.dao.SaleQuotationItemDao;
|
|
|
|
|
|
|
+import com.uas.platform.b2b.dao.*;
|
|
|
import com.uas.platform.b2b.erp.model.Inquiry;
|
|
import com.uas.platform.b2b.erp.model.Inquiry;
|
|
|
import com.uas.platform.b2b.event.SaleQuotationDecideReleaseEvent;
|
|
import com.uas.platform.b2b.event.SaleQuotationDecideReleaseEvent;
|
|
|
import com.uas.platform.b2b.event.SaleQuotationInvalidReleaseEvent;
|
|
import com.uas.platform.b2b.event.SaleQuotationInvalidReleaseEvent;
|
|
|
import com.uas.platform.b2b.event.SaleQuotationSaveEvent;
|
|
import com.uas.platform.b2b.event.SaleQuotationSaveEvent;
|
|
|
-import com.uas.platform.b2b.model.SaleQuotation;
|
|
|
|
|
-import com.uas.platform.b2b.model.SaleQuotationAll;
|
|
|
|
|
-import com.uas.platform.b2b.model.SaleQuotationDone;
|
|
|
|
|
-import com.uas.platform.b2b.model.SaleQuotationItem;
|
|
|
|
|
-import com.uas.platform.b2b.model.SearchFilter;
|
|
|
|
|
|
|
+import com.uas.platform.b2b.model.*;
|
|
|
import com.uas.platform.b2b.service.SaleQuotationService;
|
|
import com.uas.platform.b2b.service.SaleQuotationService;
|
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
import com.uas.platform.b2b.support.SystemSession;
|
|
|
import com.uas.platform.core.exception.NotFoundException;
|
|
import com.uas.platform.core.exception.NotFoundException;
|
|
@@ -38,6 +14,19 @@ import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.model.Status;
|
|
import com.uas.platform.core.model.Status;
|
|
|
import com.uas.platform.core.persistence.criteria.PredicateUtils;
|
|
import com.uas.platform.core.persistence.criteria.PredicateUtils;
|
|
|
import com.uas.search.b2b.model.SPage;
|
|
import com.uas.search.b2b.model.SPage;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
|
|
+import org.springframework.data.jpa.domain.Specification;
|
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
+
|
|
|
|
|
+import javax.persistence.criteria.CriteriaBuilder;
|
|
|
|
|
+import javax.persistence.criteria.CriteriaQuery;
|
|
|
|
|
+import javax.persistence.criteria.Predicate;
|
|
|
|
|
+import javax.persistence.criteria.Root;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.Date;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
@@ -47,7 +36,7 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SaleQuotationDao saleQuotationDao;
|
|
private SaleQuotationDao saleQuotationDao;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private SaleQuotationAllDao saleQuotationAllDao;
|
|
private SaleQuotationAllDao saleQuotationAllDao;
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -87,6 +76,7 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
|
@Override
|
|
@Override
|
|
|
public void onReplyDecide(List<SaleQuotationItem> quotationItems) {
|
|
public void onReplyDecide(List<SaleQuotationItem> quotationItems) {
|
|
|
saleQuotationItemDao.save(quotationItems);
|
|
saleQuotationItemDao.save(quotationItems);
|
|
|
|
|
+ saleQuotationDao.save(quotationItems.get(0).getQuotation());
|
|
|
ContextUtils.publishEvent(new SaleQuotationDecideReleaseEvent(quotationItems));
|
|
ContextUtils.publishEvent(new SaleQuotationDecideReleaseEvent(quotationItems));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -123,7 +113,7 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
|
saveEvent(list);// 保存触发相应的动作(关键词库、推送)
|
|
saveEvent(list);// 保存触发相应的动作(关键词库、推送)
|
|
|
return newItem;
|
|
return newItem;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 保存主动报价触发的事件(关键词库、推送)
|
|
* 保存主动报价触发的事件(关键词库、推送)
|
|
|
* @param items
|
|
* @param items
|
|
@@ -146,7 +136,7 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public SPage<SaleQuotationAll> findAllDetailByPageInfo(final PageInfo pageInfo,
|
|
public SPage<SaleQuotationAll> findAllDetailByPageInfo(final PageInfo pageInfo,
|
|
|
- final String keyword, final SearchFilter filter) {
|
|
|
|
|
|
|
+ final String keyword, final SearchFilter filter) {
|
|
|
SPage<SaleQuotationAll> quos = new SPage<SaleQuotationAll>();
|
|
SPage<SaleQuotationAll> quos = new SPage<SaleQuotationAll>();
|
|
|
if (filter != null) {
|
|
if (filter != null) {
|
|
|
if (!CollectionUtils.isEmpty(filter.getDistribute()))
|
|
if (!CollectionUtils.isEmpty(filter.getDistribute()))
|
|
@@ -171,8 +161,8 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<SaleQuotation> findNotBackQuotation() {
|
|
public List<SaleQuotation> findNotBackQuotation() {
|
|
|
- return saleQuotationDao.findByEnUUAndStatusAndBackStatus(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
|
|
- (short) Status.SUBMITTED.value(), (short) Status.NOT_UPLOAD.value());
|
|
|
|
|
|
|
+ return saleQuotationDao.findByEnUUAndStatusAndBackStatus(SystemSession.getUser().getEnterprise().getUu(),
|
|
|
|
|
+ (short) Status.SUBMITTED.value(), (short) Status.NOT_UPLOAD.value());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -205,11 +195,11 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onReplyInvalid(List<Inquiry> inquiries) {
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onReplyInvalid(List<Inquiry> inquiries) {
|
|
|
List<SaleQuotation> saveQuotations = new ArrayList<>();
|
|
List<SaleQuotation> saveQuotations = new ArrayList<>();
|
|
|
- for (Inquiry inquiry : inquiries) {
|
|
|
|
|
- if (inquiry.getB2b_qu_id() != null) {
|
|
|
|
|
|
|
+ for (Inquiry inquiry : inquiries) {
|
|
|
|
|
+ if (inquiry.getB2b_qu_id() != null) {
|
|
|
SaleQuotation quotation = saleQuotationDao.findOne(inquiry.getB2b_qu_id());
|
|
SaleQuotation quotation = saleQuotationDao.findOne(inquiry.getB2b_qu_id());
|
|
|
quotation.setStatus((short)Status.DISABLED.value());
|
|
quotation.setStatus((short)Status.DISABLED.value());
|
|
|
quotation.setInvalidSendStatus((short) Status.NOT_UPLOAD.value()); // 获取作废信息时,更新SAAS作废上传状态为待上传
|
|
quotation.setInvalidSendStatus((short) Status.NOT_UPLOAD.value()); // 获取作废信息时,更新SAAS作废上传状态为待上传
|
|
@@ -218,7 +208,7 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
|
}
|
|
}
|
|
|
ContextUtils.publishEvent(new SaleQuotationInvalidReleaseEvent(saveQuotations));
|
|
ContextUtils.publishEvent(new SaleQuotationInvalidReleaseEvent(saveQuotations));
|
|
|
saleQuotationDao.save(saveQuotations);
|
|
saleQuotationDao.save(saveQuotations);
|
|
|
- }
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public List<SaleQuotation> findNotUploadQuotationReplyInvalid() {
|
|
public List<SaleQuotation> findNotUploadQuotationReplyInvalid() {
|
|
@@ -255,6 +245,17 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void recheck(Long[] ids) {
|
|
|
|
|
+ for (Long id : ids) {
|
|
|
|
|
+ SaleQuotation quotation = saleQuotationDao.findOne(id);
|
|
|
|
|
+ if (quotation != null) {
|
|
|
|
|
+ quotation.setStatus((short) Status.INPUTTING.value());
|
|
|
|
|
+ saleQuotationDao.save(quotation);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public SPage<SaleQuotationDone> findDoneByPageInfo(final PageInfo pageInfo, SearchFilter filter) {
|
|
public SPage<SaleQuotationDone> findDoneByPageInfo(final PageInfo pageInfo, SearchFilter filter) {
|
|
|
SPage<SaleQuotationDone> quos = new SPage<SaleQuotationDone>();
|
|
SPage<SaleQuotationDone> quos = new SPage<SaleQuotationDone>();
|
|
@@ -268,7 +269,7 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
|
}
|
|
}
|
|
|
Page<SaleQuotationDone> quotations = saleQuotationDoneDao.findAll(new Specification<SaleQuotationDone>() {
|
|
Page<SaleQuotationDone> quotations = saleQuotationDoneDao.findAll(new Specification<SaleQuotationDone>() {
|
|
|
public Predicate toPredicate(Root<SaleQuotationDone> root, CriteriaQuery<?> query,
|
|
public Predicate toPredicate(Root<SaleQuotationDone> root, CriteriaQuery<?> query,
|
|
|
- CriteriaBuilder builder) {
|
|
|
|
|
|
|
+ CriteriaBuilder builder) {
|
|
|
return query.where(pageInfo.getPredicates(root, query, builder)).getRestriction();
|
|
return query.where(pageInfo.getPredicates(root, query, builder)).getRestriction();
|
|
|
}
|
|
}
|
|
|
}, pageInfo);
|
|
}, pageInfo);
|
|
@@ -279,4 +280,5 @@ public class SaleQuotationServiceImpl implements SaleQuotationService {
|
|
|
quos.setTotalPage(quotations.getTotalPages());
|
|
quos.setTotalPage(quotations.getTotalPages());
|
|
|
return quos;
|
|
return quos;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|