|
@@ -9,7 +9,6 @@ import cn.cslg.pas.common.utils.FileUtils;
|
|
|
import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
|
|
|
import cn.cslg.pas.domain.Product;
|
|
|
import cn.cslg.pas.domain.ProductCategory;
|
|
|
-import cn.cslg.pas.domain.ProductMarketData;
|
|
|
import cn.cslg.pas.domain.asso.AssoProductCategoryPicture;
|
|
|
import cn.cslg.pas.exception.XiaoShiException;
|
|
|
import cn.cslg.pas.mapper.ProductCategoryMapper;
|
|
@@ -25,10 +24,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import java.text.ParseException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 产品类别的Service层接口实现类
|
|
@@ -42,12 +38,10 @@ import java.util.stream.Collectors;
|
|
|
public class ProductCategoryServiceImpl implements IProductCategoryService {
|
|
|
private final ProductCategoryMapper productCategoryMapper;
|
|
|
private final AssoProductCategoryPictureMapper assoProductCategoryPictureMapper;
|
|
|
- private final ProductMapper productMapper;
|
|
|
private final CacheUtils cacheUtils;
|
|
|
private final LoginUtils loginUtils;
|
|
|
private final FileUtils fileUtils;
|
|
|
private final ProductServiceImpl productService;
|
|
|
- private final ProductMarketDataServiceImpl productMarketDataIService;
|
|
|
|
|
|
/**
|
|
|
* 新增产品类别
|
|
@@ -258,7 +252,7 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- //返回总的营销数据
|
|
|
+ //返回总的营销数据以及每个的营销数据
|
|
|
@Override
|
|
|
public List<ProductCategoryTrendVO> showTrend(ProductCategoryDTO dto) {
|
|
|
//判断架构id是否有内容,没有的话直接返回null
|
|
@@ -271,6 +265,7 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
|
|
|
List<ProductMarketDataTrendVO> saleVOS = new ArrayList<>();
|
|
|
//存储所有
|
|
|
ProductCategoryTrendVO totalTrendVO = new ProductCategoryTrendVO();
|
|
|
+ //返回总的营销数据 将id设为0
|
|
|
totalTrendVO.setProductId(0);
|
|
|
totalTrendVO.setProductName("总产品");
|
|
|
//查询架构id返回的总体营销数据
|
|
@@ -282,14 +277,17 @@ public class ProductCategoryServiceImpl implements IProductCategoryService {
|
|
|
} else if (dto.getTimeUnit() == null || dto.getTimeUnit() == 0) {//按照月份返回营销数据
|
|
|
totalSaleVOS = productCategoryMapper.categoryQueryByMonth(dto.getCategoryId(), dto.getCategoryArea(), dto.getCompanyName());
|
|
|
}
|
|
|
+ //把总的营销数据赋值、存入
|
|
|
totalTrendVO.setSaleVOS(totalSaleVOS);
|
|
|
trendVOS.add(totalTrendVO);
|
|
|
- //根据传入的架构id、公司名称以及营销地区查询产品id
|
|
|
+ //根据传入的类别id、公司名称以及营销地区查询产品id
|
|
|
List<ProductIdAndNameVO> idNameVOS = new ArrayList<>();
|
|
|
idNameVOS = productCategoryMapper.queryProductIdAndNameByCategoryId(dto.getCategoryId(), dto.getCompanyName());
|
|
|
//返回根据架构id查询到的每个产品id的营销数据
|
|
|
- for (ProductIdAndNameVO idNameVO : idNameVOS) {
|
|
|
+ //遍历
|
|
|
+ for (ProductIdAndNameVO idNameVO : idNameVOS) {//遍历类取得id和名称
|
|
|
ProductCategoryTrendVO trendVO = new ProductCategoryTrendVO();
|
|
|
+ //遍历赋值id和name
|
|
|
trendVO.setProductId(idNameVO.getProductId());
|
|
|
trendVO.setProductName(idNameVO.getProductName());
|
|
|
List<ProductMarketDataTrendVO> temSaleVOS = new ArrayList<>();
|