|
@@ -7,6 +7,7 @@ import com.example.xiaoshiweixinback.business.common.base.Records;
|
|
import com.example.xiaoshiweixinback.business.common.base.SystemFile;
|
|
import com.example.xiaoshiweixinback.business.common.base.SystemFile;
|
|
import com.example.xiaoshiweixinback.business.utils.CacheUtil;
|
|
import com.example.xiaoshiweixinback.business.utils.CacheUtil;
|
|
import com.example.xiaoshiweixinback.business.utils.LoginUtils;
|
|
import com.example.xiaoshiweixinback.business.utils.LoginUtils;
|
|
|
|
+import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
|
|
import com.example.xiaoshiweixinback.domain.AssoProductFile;
|
|
import com.example.xiaoshiweixinback.domain.AssoProductFile;
|
|
import com.example.xiaoshiweixinback.domain.Product;
|
|
import com.example.xiaoshiweixinback.domain.Product;
|
|
import com.example.xiaoshiweixinback.entity.dto.GetProductDTO;
|
|
import com.example.xiaoshiweixinback.entity.dto.GetProductDTO;
|
|
@@ -38,6 +39,7 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> {
|
|
private final LoginUtils loginUtils;
|
|
private final LoginUtils loginUtils;
|
|
private final AssoProductFileService assoProductFileService;
|
|
private final AssoProductFileService assoProductFileService;
|
|
private final FileManagerService fileManagerService;
|
|
private final FileManagerService fileManagerService;
|
|
|
|
+ private final AssoPersonProductService assoPersonProductService;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 查询爆款产品
|
|
* 查询爆款产品
|
|
@@ -74,6 +76,19 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> {
|
|
}
|
|
}
|
|
|
|
|
|
private void loadProduct(List<ProductVO> productVOS) {
|
|
private void loadProduct(List<ProductVO> productVOS) {
|
|
|
|
+ PersonnelVO personnelVO = null;
|
|
|
|
+ try {
|
|
|
|
+ personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ List<AssoPersonProduct> assoPersonProducts = new ArrayList<>();
|
|
|
|
+ if (personnelVO != null) {
|
|
|
|
+ String personUuid = personnelVO.getUuid();
|
|
|
|
+ LambdaQueryWrapper<AssoPersonProduct> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
|
+ queryWrapper.eq(AssoPersonProduct::getPersonUuid, personUuid);
|
|
|
|
+ assoPersonProducts = assoPersonProductService.list(queryWrapper);
|
|
|
|
+ }
|
|
List<AssoProductFile> assoProductFiles = new ArrayList<>();
|
|
List<AssoProductFile> assoProductFiles = new ArrayList<>();
|
|
List<String> guids = new ArrayList<>();
|
|
List<String> guids = new ArrayList<>();
|
|
if (productVOS == null || productVOS.size() == 0) {
|
|
if (productVOS == null || productVOS.size() == 0) {
|
|
@@ -115,6 +130,11 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (assoPersonProducts.size() != 0) {
|
|
|
|
+ AssoPersonProduct assoPersonProduct = assoPersonProducts.stream().filter(item -> item.getProductId().equals(productVO.getId())).findFirst().orElse(null);
|
|
|
|
+ productVO.setConcernType(assoPersonProduct.getConcernType());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -137,7 +157,7 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> {
|
|
Product product = new Product();
|
|
Product product = new Product();
|
|
BeanUtils.copyProperties(productAddDTO, product);
|
|
BeanUtils.copyProperties(productAddDTO, product);
|
|
// PersonnelVO personnelVO = cacheUtil.getLoginUser(loginUtils.getId());
|
|
// PersonnelVO personnelVO = cacheUtil.getLoginUser(loginUtils.getId());
|
|
- PersonnelVO personnelVO =new PersonnelVO();
|
|
|
|
|
|
+ PersonnelVO personnelVO = new PersonnelVO();
|
|
personnelVO.setUuid("1213");
|
|
personnelVO.setUuid("1213");
|
|
product.setCreateId(personnelVO.getUuid());
|
|
product.setCreateId(personnelVO.getUuid());
|
|
product.setIfCustomized(true);
|
|
product.setIfCustomized(true);
|
|
@@ -157,6 +177,37 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> {
|
|
product.updateById();
|
|
product.updateById();
|
|
return product;
|
|
return product;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询爆款产品
|
|
|
|
+ *
|
|
|
|
+ * @param productDTO
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public Records queryConcernProduct(ProductDTO productDTO) {
|
|
|
|
+ Records records = new Records();
|
|
|
|
+ Long size = productDTO.getSize();
|
|
|
|
+ Long current = productDTO.getCurrent();
|
|
|
|
+ records.setCurrent(current);
|
|
|
|
+ records.setSize(size);
|
|
|
|
+ records.setData(new ArrayList<>());
|
|
|
|
+ records.setTotal(0L);
|
|
|
|
+ String name = productDTO.getName();
|
|
|
|
+ PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
|
|
|
|
+
|
|
|
|
+ GetProductDTO getProductDTO = new GetProductDTO();
|
|
|
|
+ getProductDTO.setName(name);
|
|
|
|
+ getProductDTO.setCurrent(current);
|
|
|
|
+ getProductDTO.setSize(size);
|
|
|
|
+ getProductDTO.setPersonUuid(personnelVO.getUuid());
|
|
|
|
+ List<ProductVO> productVOs = this.getBaseMapper().getConcernProduct(getProductDTO);
|
|
|
|
+ Long count = this.getBaseMapper().getConcernProductCount(getProductDTO);
|
|
|
|
+ this.loadProduct(productVOs);
|
|
|
|
+ records.setData(productVOs);
|
|
|
|
+ records.setTotal(count);
|
|
|
|
+ return records;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|