|
|
@@ -1,16 +1,25 @@
|
|
|
package com.uas.platform.b2c.prod.product.brand.service.impl;
|
|
|
|
|
|
+import com.uas.platform.b2c.core.constant.Status;
|
|
|
import com.uas.platform.b2c.prod.product.brand.dao.BrandDao;
|
|
|
import com.uas.platform.b2c.prod.product.brand.dao.VendorListDao;
|
|
|
+import com.uas.platform.b2c.prod.product.brand.dao.VendorListSubmitDao;
|
|
|
import com.uas.platform.b2c.prod.product.brand.modal.Brand;
|
|
|
import com.uas.platform.b2c.prod.product.brand.modal.VendorList;
|
|
|
+import com.uas.platform.b2c.prod.product.brand.modal.VendorListSubmit;
|
|
|
import com.uas.platform.b2c.prod.product.brand.service.VendorListService;
|
|
|
import com.uas.platform.b2c.prod.store.dao.StoreInDao;
|
|
|
import com.uas.platform.b2c.prod.store.model.StoreIn;
|
|
|
import com.uas.platform.core.exception.IllegalOperatorException;
|
|
|
+import com.uas.platform.core.model.Constant;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
import com.uas.platform.core.persistence.criteria.CriterionExpression;
|
|
|
import com.uas.platform.core.persistence.criteria.SimpleExpression;
|
|
|
+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.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
@@ -19,12 +28,6 @@ import org.springframework.data.jpa.domain.Specification;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
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 java.util.List;
|
|
|
-
|
|
|
/**
|
|
|
* Created by wangyc on 2017/11/27.
|
|
|
*
|
|
|
@@ -35,13 +38,16 @@ public class VendorListServiceImpl implements VendorListService{
|
|
|
|
|
|
private final VendorListDao vendorListDao;
|
|
|
|
|
|
+ private final VendorListSubmitDao vendorListSubmitDao;
|
|
|
+
|
|
|
private final BrandDao brandDao;
|
|
|
|
|
|
private final StoreInDao storeInDao;
|
|
|
|
|
|
@Autowired
|
|
|
- public VendorListServiceImpl (VendorListDao vendorListDao, BrandDao brandDao, StoreInDao storeInDao) {
|
|
|
+ public VendorListServiceImpl (VendorListDao vendorListDao, VendorListSubmitDao vendorListSubmitDao, BrandDao brandDao, StoreInDao storeInDao) {
|
|
|
this.vendorListDao = vendorListDao;
|
|
|
+ this.vendorListSubmitDao = vendorListSubmitDao;
|
|
|
this.brandDao = brandDao;
|
|
|
this.storeInDao = storeInDao;
|
|
|
}
|
|
|
@@ -70,6 +76,15 @@ public class VendorListServiceImpl implements VendorListService{
|
|
|
// 装载店铺信息
|
|
|
if (CollectionUtils.isNotEmpty(vendorLists)) {
|
|
|
for (VendorList vendorList : vendorLists) {
|
|
|
+ // 如果供应商信息申请状态为正在申请中,用申请信息替换它
|
|
|
+ if (Constant.YES == vendorList.getIsSubmited()) {
|
|
|
+ List<VendorListSubmit> vendorListSubmits = vendorListSubmitDao.findByVendoridAndStatus(vendorList.getId(),
|
|
|
+ Status.SUBMITTED.value());
|
|
|
+ if (CollectionUtils.isNotEmpty(vendorListSubmits)) {
|
|
|
+ convertBySubmit(vendorList, vendorListSubmits.get(0));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (vendorList.getStoreuuid() != null) {
|
|
|
StoreIn store = storeInDao.findByUuid(vendorList.getStoreuuid());
|
|
|
if (store != null) {
|
|
|
@@ -81,4 +96,18 @@ public class VendorListServiceImpl implements VendorListService{
|
|
|
|
|
|
return new PageImpl<VendorList>(vendorLists, pageInfo, vendorListPage.getTotalElements());
|
|
|
}
|
|
|
+
|
|
|
+ private void convertBySubmit(VendorList vendorList, VendorListSubmit vendorListSubmit) {
|
|
|
+ vendorList.setArea(vendorListSubmit.getArea());
|
|
|
+ vendorList.setBranduuid(vendorListSubmit.getBranduuid());
|
|
|
+ vendorList.setDetailAddress(vendorListSubmit.getDetailAddress());
|
|
|
+ vendorList.setEmail(vendorListSubmit.getEmail());
|
|
|
+ vendorList.setLicense(vendorListSubmit.getLicense());
|
|
|
+ vendorList.setStoreuuid(vendorListSubmit.getStoreuuid());
|
|
|
+ vendorList.setTel(vendorListSubmit.getTel());
|
|
|
+ vendorList.setFax(vendorListSubmit.getFax());
|
|
|
+ vendorList.setVendorName(vendorListSubmit.getVendorName());
|
|
|
+ vendorList.setWebsite(vendorListSubmit.getWebsite());
|
|
|
+ vendorList.setImg(vendorListSubmit.getImg());
|
|
|
+ }
|
|
|
}
|