|
|
@@ -7,7 +7,9 @@ import com.uas.platform.b2c.core.utils.StringUtilB2C;
|
|
|
import com.uas.platform.b2c.prod.commodity.dao.GoodsDao;
|
|
|
import com.uas.platform.b2c.prod.commodity.model.Goods;
|
|
|
import com.uas.platform.b2c.prod.product.brand.dao.BrandDao;
|
|
|
+import com.uas.platform.b2c.prod.product.brand.modal.Brand;
|
|
|
import com.uas.platform.b2c.prod.product.component.dao.ComponentDao;
|
|
|
+import com.uas.platform.b2c.prod.product.component.modal.Component;
|
|
|
import com.uas.platform.b2c.trade.seek.dao.*;
|
|
|
import com.uas.platform.b2c.trade.seek.model.*;
|
|
|
import com.uas.platform.b2c.trade.seek.service.SeekPurchaseBomService;
|
|
|
@@ -534,6 +536,9 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
|
|
|
inquiryItem.setProduceDate(batch.getProduceDate());
|
|
|
inquiryItem.setDate(new Date());
|
|
|
inquiryItem.setEndDate(batch.getDeadline());
|
|
|
+ if (StringUtils.isEmpty(batch.getKind())) {
|
|
|
+ batch.setKind(matchKind(batch.getBrand(), batch.getCode()));
|
|
|
+ }
|
|
|
inquiryItem.setProdTitle(batch.getKind());
|
|
|
inquiryItem.setSpec(batch.getSpec());
|
|
|
if (StringUtils.isEmpty(endDate)) {
|
|
|
@@ -589,6 +594,39 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
|
|
|
return ResultMap.success(result);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据型号和品牌类目匹配
|
|
|
+ * @param brand
|
|
|
+ * @param code
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String matchKind(String brand, String code) {
|
|
|
+ // 匹配类目
|
|
|
+ String kind = "";
|
|
|
+ Long brandId = null;
|
|
|
+ List<Brand> brands = brandDao.findByUpperNameEn(brand);
|
|
|
+ if (CollectionUtils.isEmpty(brands)) {
|
|
|
+ brands = brandDao.findByUpperNameCn(brand);
|
|
|
+ if (CollectionUtils.isEmpty(brands)) {
|
|
|
+ kind = "其他";
|
|
|
+ } else {
|
|
|
+ brandId = brands.get(0).getId();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ brandId = brands.get(0).getId();
|
|
|
+ }
|
|
|
+ if (brandId != null) {
|
|
|
+ List<Component> components = componentDao
|
|
|
+ .findByCodeAndBrandid(code, brandId);
|
|
|
+ if (!CollectionUtils.isEmpty(components)) {
|
|
|
+ kind = components.get(0).getKind().getNameCn();
|
|
|
+ } else {
|
|
|
+ kind = "其他";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return kind;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Page<SeekPurchaseBomList> getSeekPurchaseBomListPage(final PageInfo pageInfo, User user, String minReleaseDate, String maxReleaseDate, String name) {
|
|
|
if (user.getEnterprise() != null) {
|