|
|
@@ -1,5 +1,6 @@
|
|
|
package com.uas.platform.b2c.prod.product.brand.service.impl;
|
|
|
|
|
|
+import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
|
|
|
import com.uas.platform.b2c.common.account.dao.UserBaseInfoDao;
|
|
|
import com.uas.platform.b2c.common.account.model.UserBaseInfo;
|
|
|
import com.uas.platform.b2c.core.constant.Status;
|
|
|
@@ -14,6 +15,7 @@ import com.uas.platform.b2c.prod.product.brand.modal.VendorListSubmit;
|
|
|
import com.uas.platform.b2c.prod.product.brand.service.VendorListSubmitService;
|
|
|
import com.uas.platform.b2c.prod.store.dao.StoreInDao;
|
|
|
import com.uas.platform.b2c.prod.store.model.StoreIn;
|
|
|
+import com.uas.platform.b2c.prod.store.model.StoreStatus;
|
|
|
import com.uas.platform.core.exception.IllegalOperatorException;
|
|
|
import com.uas.platform.core.model.Constant;
|
|
|
import com.uas.platform.core.model.PageInfo;
|
|
|
@@ -56,13 +58,16 @@ public class VendorListSubmitServiceImpl implements VendorListSubmitService {
|
|
|
|
|
|
private final UserBaseInfoDao userBaseInfoDao;
|
|
|
|
|
|
+ private final EnterpriseDao enterpriseDao;
|
|
|
+
|
|
|
@Autowired
|
|
|
- public VendorListSubmitServiceImpl(VendorListDao vendorListDao, VendorListSubmitDao vendorListSubmitDao, BrandDao brandDao, StoreInDao storeInDao, UserBaseInfoDao userBaseInfoDao){
|
|
|
+ public VendorListSubmitServiceImpl(VendorListDao vendorListDao, VendorListSubmitDao vendorListSubmitDao, BrandDao brandDao, StoreInDao storeInDao, UserBaseInfoDao userBaseInfoDao, EnterpriseDao enterpriseDao){
|
|
|
this.vendorListDao = vendorListDao;
|
|
|
this.vendorListSubmitDao = vendorListSubmitDao;
|
|
|
this.brandDao = brandDao;
|
|
|
this.storeInDao = storeInDao;
|
|
|
this.userBaseInfoDao = userBaseInfoDao;
|
|
|
+ this.enterpriseDao = enterpriseDao;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -373,16 +378,32 @@ public class VendorListSubmitServiceImpl implements VendorListSubmitService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 关联店铺名称
|
|
|
+ // 关联企业名称
|
|
|
if (row.getCell(8) != null) {
|
|
|
row.getCell(8).setCellType(Cell.CELL_TYPE_STRING);
|
|
|
- String storeName = row.getCell(8).getStringCellValue().trim();
|
|
|
-
|
|
|
- if (StringUtils.hasText(storeName)) {
|
|
|
- StoreIn storeIn = storeInDao.findByStoreName(storeName);
|
|
|
- if (storeIn == null)
|
|
|
- throw new IllegalOperatorException("第" + (r+1) + "行店铺:" + storeIn.getStoreName() + " 不存在");
|
|
|
- vendorListSubmit.setStoreuuid(storeIn.getUuid());
|
|
|
+ String enName = row.getCell(8).getStringCellValue().trim();
|
|
|
+
|
|
|
+ if (StringUtils.hasText(enName)) {
|
|
|
+ List<Long> enuu = enterpriseDao.findEnuuByName(enName);
|
|
|
+ if (CollectionUtils.isNotEmpty(enuu)) {
|
|
|
+ List<StoreIn> storeInExist = storeInDao.findByEnUU(enuu.get(0));
|
|
|
+ if (CollectionUtils.isNotEmpty(storeInExist)) {
|
|
|
+ StoreIn storeIn = storeInExist.get(0);
|
|
|
+ if (StoreStatus.OPENED == storeIn.getStatus()) {
|
|
|
+ VendorList vendorLists = vendorListDao.findByBranduuidAndStoreuuid(vendorListSubmit.getBranduuid(), storeIn.getUuid());
|
|
|
+ if (vendorLists != null) {
|
|
|
+ throw new IllegalOperatorException("第" + (r+1) + "行企业:" + enName + " 店铺,在当前品牌下已关联供应商");
|
|
|
+ }
|
|
|
+ vendorListSubmit.setStoreuuid(storeIn.getUuid());
|
|
|
+ } else {
|
|
|
+ throw new IllegalOperatorException("第" + (r+1) + "行企业:" + enName + " 店铺不为已开通状态");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new IllegalOperatorException("第" + (r+1) + "行企业:" + enName + "未开通店铺");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new IllegalOperatorException("第" + (r+1) + "行企业:" + enName + "不存在");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// 邮箱
|