|
@@ -38,14 +38,14 @@ public class BrandServiceImpl implements BrandService {
|
|
|
@Autowired
|
|
|
CategoryMapper categoryMapper;
|
|
|
@Autowired
|
|
|
+ IndustryCategoryDao industryCategoryDao;
|
|
|
+ @Autowired
|
|
|
StoreWdDao storeWdDao;
|
|
|
@Autowired
|
|
|
TypeByDao typeByDao;
|
|
|
@Autowired
|
|
|
WdInfoServiceImpl wdInfoService;
|
|
|
@Autowired
|
|
|
- BrandStoreOpcloseDao storeOpcloseDao;
|
|
|
- @Autowired
|
|
|
CategoryUtil categoryUtil;
|
|
|
@Autowired
|
|
|
BrandEvolveDao brandEvolveDao;
|
|
@@ -59,10 +59,18 @@ public class BrandServiceImpl implements BrandService {
|
|
|
|
|
|
@Override
|
|
|
public List<BrandSearch> searchByLikeName(String text) {
|
|
|
- List<Brand> list = brandMapper.searchList(text);
|
|
|
+ // 根据品牌名称模糊查询
|
|
|
+ QueryWrapper<Brand> brandQueryWrapper = new QueryWrapper<>();
|
|
|
+ brandQueryWrapper.like("brand_name", text)
|
|
|
+ .eq("show_delete", 0);
|
|
|
+ List<Brand> list = brandMapper.selectList(brandQueryWrapper);
|
|
|
+
|
|
|
List<BrandSearch> sList = new ArrayList<>();
|
|
|
- for (Brand brand : list){
|
|
|
- Enterprise enterprise = enterpriseMapper.searchByUsci(brand.getEnterpriseUsci());
|
|
|
+ // 补齐品牌的企业信息
|
|
|
+ for (Brand brand : list) {
|
|
|
+ QueryWrapper<Enterprise> enterpriseQueryWrapper = new QueryWrapper<>();
|
|
|
+ enterpriseQueryWrapper.eq("enterprise_usci", brand.getEnterpriseUsci());
|
|
|
+ Enterprise enterprise = enterpriseMapper.selectOne(enterpriseQueryWrapper);
|
|
|
BrandSearch bs = new BrandSearch();
|
|
|
bs.setBrandId(brand.getBrandId());
|
|
|
bs.setBrandName(brand.getBrandName());
|
|
@@ -76,116 +84,107 @@ public class BrandServiceImpl implements BrandService {
|
|
|
|
|
|
@Override
|
|
|
public BrandInfo searchByBrandId(String brandId, String userId) {
|
|
|
- Brand brand = brandMapper.searchById(brandId);
|
|
|
- BrandInfo info = new BrandInfo();
|
|
|
- if (brand != null){
|
|
|
- Enterprise enterprise = enterpriseMapper.searchByUsci(brand.getEnterpriseUsci());
|
|
|
- info.setBrandId(brandId);
|
|
|
- info.setBrandName(brand.getBrandName());
|
|
|
- info.setBrandImg(brand.getBrandImg());
|
|
|
- info.setIndexScore(brand.getIndexScore());
|
|
|
- if (enterprise != null){
|
|
|
- info.setEnterpriseUsci(enterprise.getEnterpriseUsci());
|
|
|
- info.setEnterpriseName(enterprise.getEnterpriseName());
|
|
|
- info.setAddrCode(enterprise.getAddrCode());
|
|
|
- info.setAddrInfo(enterprise.getAddrInfo());
|
|
|
- }
|
|
|
- info.setUpdateTime(brand.getUpdateTime());
|
|
|
- QueryWrapper<AttentionPool> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("brand_id",brandId);
|
|
|
- queryWrapper.eq("wd_id","");
|
|
|
- AttentionPool pool = attentionPoolDao.selectOne(queryWrapper);
|
|
|
- if (pool == null)
|
|
|
- info.setAttention(0);
|
|
|
- else
|
|
|
- info.setAttention(1);
|
|
|
- }else return null;
|
|
|
+ // 查询品牌
|
|
|
+ QueryWrapper<Brand> brandQueryWrapper = new QueryWrapper<>();
|
|
|
+ brandQueryWrapper.eq("brand_id", brandId)
|
|
|
+ .eq("show_delete", 0);
|
|
|
+ Brand brand = brandMapper.selectOne(brandQueryWrapper);
|
|
|
+
|
|
|
+ if (brand == null)
|
|
|
+ return null;
|
|
|
+ // 查询企业
|
|
|
+ QueryWrapper<Enterprise> enterpriseQueryWrapper = new QueryWrapper<>();
|
|
|
+ enterpriseQueryWrapper.eq("enterprise_usci", brand.getEnterpriseUsci());
|
|
|
+ Enterprise enterprise = enterpriseMapper.selectOne(enterpriseQueryWrapper);
|
|
|
+ // 赋值
|
|
|
+ BrandInfo info = new BrandInfo(brand, enterprise);
|
|
|
+ if (brand.getIndustryCode() != null) {
|
|
|
+ QueryWrapper<IndustryCategory> industryCategoryQueryWrapper = new QueryWrapper<>();
|
|
|
+ industryCategoryQueryWrapper.eq("industry_code", brand.getIndustryCode());
|
|
|
+ IndustryCategory industryCategory = industryCategoryDao.selectOne(industryCategoryQueryWrapper);
|
|
|
+ info.setIndustryName(industryCategory != null ? industryCategory.getSubCategory() : null);
|
|
|
+ } else info.setIndustryName(null);
|
|
|
+ // 是否已经关注
|
|
|
+ QueryWrapper<AttentionPool> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("brand_id", brandId)
|
|
|
+ .eq("wd_id", "");
|
|
|
+ AttentionPool pool = attentionPoolDao.selectOne(queryWrapper);
|
|
|
+ info.setAttention(pool == null ? 0 : 1);
|
|
|
return info;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public BrandProperty searchPropertyByBrandId(String brandId) {
|
|
|
- BrandStatistics brandStatistics = brandStatisticsMapper.searchByBrandId(brandId);
|
|
|
- Brand brand = brandMapper.searchById(brandId);
|
|
|
+ // 获取品牌统计信息
|
|
|
+ QueryWrapper<BrandStatistics> statisticsQueryWrapper = new QueryWrapper<>();
|
|
|
+ statisticsQueryWrapper.eq("brand_id", brandId);
|
|
|
+ BrandStatistics brandStatistics = brandStatisticsMapper.selectOne(statisticsQueryWrapper);
|
|
|
+
|
|
|
+ QueryWrapper<Brand> brandQueryWrapper = new QueryWrapper<>();
|
|
|
+ brandQueryWrapper.eq("brand_id", brandId)
|
|
|
+ .eq("show_delete", 0);
|
|
|
+ Brand brand = brandMapper.selectOne(brandQueryWrapper);
|
|
|
+
|
|
|
+ // 赋值
|
|
|
BrandProperty bp = new BrandProperty();
|
|
|
- if (brand != null){
|
|
|
+ if (brand != null) {
|
|
|
bp.setIndustryCode(brand.getIndustryCode());
|
|
|
if (brand.getIndustryCode() == null || brand.getIndustryCode().equals(""))
|
|
|
bp.setIndustryName("");
|
|
|
- else{
|
|
|
- Category category = categoryMapper.searchSubIndustryByCode(brand.getIndustryCode());
|
|
|
- bp.setIndustryName(category.getName());
|
|
|
- }
|
|
|
+ else
|
|
|
+ bp.setIndustryName(categoryMapper.searchSubIndustryByCode(brand.getIndustryCode()).getName());
|
|
|
bp.setPerCapitaConsumption(brand.getPerCapitaConsumption());
|
|
|
bp.setCommentCount(brand.getCommentCount());
|
|
|
bp.setScore(brand.getScore());
|
|
|
- }else {
|
|
|
- bp.setIndustryName("****");
|
|
|
- bp.setPerCapitaConsumption(null);
|
|
|
- bp.setCommentCount(null);
|
|
|
- bp.setScore(null);
|
|
|
- }
|
|
|
- if (brandStatistics != null){
|
|
|
- float activeRatio = (float) brandStatistics.getBusinessCount()/brandStatistics.getTotal();
|
|
|
- bp.setActiveRatio((int)(activeRatio*100)+"%");
|
|
|
- }else {
|
|
|
- bp.setActiveRatio("****");
|
|
|
- }
|
|
|
+ } else bp.setIndustryName("****");
|
|
|
+ if (brandStatistics != null) {
|
|
|
+ float activeRatio = (float) brandStatistics.getBusinessCount() / brandStatistics.getTotal();
|
|
|
+ bp.setActiveRatio((int) (activeRatio * 100) + "%");
|
|
|
+ } else bp.setActiveRatio("****");
|
|
|
return bp;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<BrandSimilar> searchSimilarByBrandId(String brandId) {
|
|
|
-// 先查询品牌id得到industryCode
|
|
|
- Brand brand = brandMapper.searchById(brandId);
|
|
|
+ // 先查询品牌id得到industryCode
|
|
|
+ QueryWrapper<Brand> brandQueryWrapper = new QueryWrapper<>();
|
|
|
+ brandQueryWrapper.eq("brand_id", brandId)
|
|
|
+ .eq("show_delete", 0);
|
|
|
+ Brand brand = brandMapper.selectOne(brandQueryWrapper);
|
|
|
if (brand == null)
|
|
|
return new ArrayList<>();
|
|
|
-// 再根据industryCode得到其他品牌的信息
|
|
|
+
|
|
|
+ // 再根据industryCode得到其他品牌的信息
|
|
|
if (brand.getIndustryCode() == null)
|
|
|
return new ArrayList<>();
|
|
|
List<Brand> brands = brandMapper.searchByIndustryCodeList(brandId, brand.getIndustryCode());
|
|
|
if (brands.isEmpty())
|
|
|
return new ArrayList<>();
|
|
|
+
|
|
|
List<BrandSimilar> similarList = new ArrayList<>();
|
|
|
- for (Brand b : brands){
|
|
|
- BrandSimilar bs = new BrandSimilar();
|
|
|
- bs.setBrandId(b.getBrandId());
|
|
|
- bs.setBrandImg(b.getBrandImg());
|
|
|
- bs.setBrandName(b.getBrandName());
|
|
|
- bs.setUpdateTime(b.getUpdateTime());
|
|
|
- similarList.add(bs);
|
|
|
- }
|
|
|
+ brands.forEach(b -> similarList.add(new BrandSimilar(b)));
|
|
|
return similarList;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<BrandStatus> searchStatusByBrandId(String brandId) {
|
|
|
// 查询状态后拆分
|
|
|
- BrandStatistics statistics = brandStatisticsMapper.searchByBrandId(brandId);
|
|
|
- if (statistics == null)
|
|
|
- return new ArrayList<>();
|
|
|
+ QueryWrapper<BrandStatistics> statisticsQueryWrapper = new QueryWrapper<>();
|
|
|
+ statisticsQueryWrapper.eq("brand_id", brandId);
|
|
|
+ BrandStatistics statistics = brandStatisticsMapper.selectOne(statisticsQueryWrapper);
|
|
|
+
|
|
|
+ if (statistics == null) return new ArrayList<>();
|
|
|
int businessCount = statistics.getBusinessCount();
|
|
|
int pauseBusinessCount = statistics.getPauseBusinessCount();
|
|
|
int noBusinessCount = statistics.getNoBusinessCount();
|
|
|
+
|
|
|
List<BrandStatus> statuses = new ArrayList<>();
|
|
|
- if (businessCount != 0){
|
|
|
- BrandStatus status = new BrandStatus();
|
|
|
- status.setBusinessStatus("正常");
|
|
|
- status.setCount(businessCount);
|
|
|
- statuses.add(status);
|
|
|
- }
|
|
|
- if (pauseBusinessCount != 0){
|
|
|
- BrandStatus status = new BrandStatus();
|
|
|
- status.setBusinessStatus("暂停");
|
|
|
- status.setCount(pauseBusinessCount);
|
|
|
- statuses.add(status);
|
|
|
- }
|
|
|
- if (noBusinessCount != 0){
|
|
|
- BrandStatus status = new BrandStatus();
|
|
|
- status.setBusinessStatus("尚未营业");
|
|
|
- status.setCount(noBusinessCount);
|
|
|
- statuses.add(status);
|
|
|
- }
|
|
|
+ if (businessCount != 0)
|
|
|
+ statuses.add(new BrandStatus("正常", businessCount));
|
|
|
+ if (pauseBusinessCount != 0)
|
|
|
+ statuses.add(new BrandStatus("暂停", pauseBusinessCount));
|
|
|
+ if (noBusinessCount != 0)
|
|
|
+ statuses.add(new BrandStatus("尚未营业", noBusinessCount));
|
|
|
return statuses;
|
|
|
}
|
|
|
|
|
@@ -198,71 +197,51 @@ public class BrandServiceImpl implements BrandService {
|
|
|
int province = 31;
|
|
|
int city = 342;
|
|
|
int zone = 2989;
|
|
|
- BrandStatistics statistics = brandStatisticsMapper.searchByBrandId(brandId);
|
|
|
+
|
|
|
+ QueryWrapper<BrandStatistics> statisticsQueryWrapper = new QueryWrapper<>();
|
|
|
+ statisticsQueryWrapper.eq("brand_id", brandId);
|
|
|
+ BrandStatistics statistics = brandStatisticsMapper.selectOne(statisticsQueryWrapper);
|
|
|
if (statistics == null)
|
|
|
return null;
|
|
|
- BrandDistribution bd = new BrandDistribution();
|
|
|
- int cpc = statistics.getCoverProvinceCount();
|
|
|
- int ccc = statistics.getCoverCityCount();
|
|
|
- int czc = statistics.getCoverZoneCount();
|
|
|
- bd.setTotal(statistics.getTotal());
|
|
|
- bd.setCoverProvinceCount(cpc);
|
|
|
- float provinceRatio = (float) cpc/province;
|
|
|
- bd.setCoverProvinceRatio((int)(provinceRatio*100) + "%");
|
|
|
- bd.setCoverCityCount(ccc);
|
|
|
- float cityRatio = (float) ccc/city;
|
|
|
- bd.setCoverCityRatio((int)(cityRatio*100) + "%");
|
|
|
- bd.setCoverZoneCount(czc);
|
|
|
- float zoneRatio = (float) czc/zone;
|
|
|
- bd.setCoverZoneRatio((int)(zoneRatio*100) + "%");
|
|
|
- return bd;
|
|
|
+
|
|
|
+ return new BrandDistribution(statistics, province, city, zone);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<BrandProvinceBo> searchProvinceByBrandId(String brandId) {
|
|
|
- List<BrandProvince> provinces = brandProvinceMapper.searchByBrandId(brandId);
|
|
|
- BrandStatistics statistics = brandStatisticsMapper.searchByBrandId(brandId);
|
|
|
- if (provinces.isEmpty() || statistics == null)
|
|
|
+ // 查询品牌省级分布
|
|
|
+ QueryWrapper<BrandProvince> provinceQueryWrapper = new QueryWrapper<>();
|
|
|
+ provinceQueryWrapper.eq("brand_id", brandId);
|
|
|
+ List<BrandProvince> provinces = brandProvinceMapper.selectList(provinceQueryWrapper);
|
|
|
+ // 查询品牌统计信息
|
|
|
+ QueryWrapper<BrandStatistics> statisticsQueryWrapper = new QueryWrapper<>();
|
|
|
+ statisticsQueryWrapper.eq("brand_id", brandId);
|
|
|
+ BrandStatistics statistics = brandStatisticsMapper.selectOne(statisticsQueryWrapper);
|
|
|
+
|
|
|
+ if (provinces == null || provinces.isEmpty() || statistics == null)
|
|
|
return new ArrayList<>();
|
|
|
- int total = statistics.getTotal();
|
|
|
+
|
|
|
List<BrandProvinceBo> bpbs = new ArrayList<>();
|
|
|
- for (BrandProvince bp : provinces){
|
|
|
- int disCount = bp.getDisCount();
|
|
|
- BrandProvinceBo bpb = new BrandProvinceBo();
|
|
|
-// bpb.setBrandId(bp.getBrandId());
|
|
|
- bpb.setCode(bp.getAddrCode());
|
|
|
- bpb.setName(bp.getProvince());
|
|
|
- bpb.setLocation(bp.getLat().toString() + "," + bp.getLng().toString());
|
|
|
- bpb.setCount(disCount);
|
|
|
- float ratio = (float) disCount/total;
|
|
|
- bpb.setRatio((ratio*100) + "%");
|
|
|
- bpb.setUpdateTime(bp.getUpdateTime());
|
|
|
- bpbs.add(bpb);
|
|
|
- }
|
|
|
+ provinces.forEach(bp -> bpbs.add(new BrandProvinceBo(bp, statistics.getTotal())));
|
|
|
return bpbs;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public BrandDisCloud searchDisCloudByBrandId(String brandId) {
|
|
|
- List<BrandCity> brandCities = brandCityMapper.searchByBrandId(brandId);
|
|
|
- List<BrandZone> brandZones = brandZoneMapper.searchByBrandId(brandId);
|
|
|
+ // 获取市级别统计分布数据
|
|
|
+ QueryWrapper<BrandCity> cityQueryWrapper = new QueryWrapper<>();
|
|
|
+ cityQueryWrapper.eq("brand_id", brandId);
|
|
|
+ List<BrandCity> brandCities = brandCityMapper.selectList(cityQueryWrapper);
|
|
|
+ // 获取区级别统计分布数据
|
|
|
+ QueryWrapper<BrandZone> zoneQueryWrapper = new QueryWrapper<>();
|
|
|
+ zoneQueryWrapper.eq("brand_id", brandId);
|
|
|
+ List<BrandZone> brandZones = brandZoneMapper.selectList(zoneQueryWrapper);
|
|
|
+
|
|
|
BrandDisCloud disCloud = new BrandDisCloud();
|
|
|
List<BrandDisItem> zoneDis = new ArrayList<>();
|
|
|
List<BrandDisItem> cityDis = new ArrayList<>();
|
|
|
- for (BrandZone bz : brandZones){
|
|
|
- BrandDisItem bdi = new BrandDisItem();
|
|
|
- bdi.setCode(bz.getAddrCode());
|
|
|
- bdi.setName(bz.getZone());
|
|
|
- bdi.setCount(bz.getDisCount());
|
|
|
- zoneDis.add(bdi);
|
|
|
- }
|
|
|
- for (BrandCity bc : brandCities){
|
|
|
- BrandDisItem bdi = new BrandDisItem();
|
|
|
- bdi.setCode(bc.getAddrCode());
|
|
|
- bdi.setName(bc.getCity());
|
|
|
- bdi.setCount(bc.getDisCount());
|
|
|
- cityDis.add(bdi);
|
|
|
- }
|
|
|
+ brandZones.forEach(zone -> zoneDis.add(new BrandDisItem(zone)));
|
|
|
+ brandCities.forEach(city -> zoneDis.add(new BrandDisItem(city)));
|
|
|
disCloud.setZoneDistribution(zoneDis);
|
|
|
disCloud.setCityDistribution(cityDis);
|
|
|
return disCloud;
|
|
@@ -270,48 +249,53 @@ public class BrandServiceImpl implements BrandService {
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<List<BrandSearch>> searchListByMulti(ListQueryBody body, String userId) {
|
|
|
- PageHelper.startPage(body.getPageNum(),body.getPageSize(),true);
|
|
|
- String text = body.getText();
|
|
|
+ PageHelper.startPage(body.getPageNum(), body.getPageSize(), true);
|
|
|
List<String> industryCode = body.getIndustryCode();
|
|
|
+ /*
|
|
|
+ industryCode行业类别码,例如101000,但不确定,需要对其拆解,查询其子类别。
|
|
|
+ 因数据库数据不齐,这里没有进行相关处理
|
|
|
+ */
|
|
|
Integer countDown = null;
|
|
|
Integer countUp = null;
|
|
|
Integer coverDown = null;
|
|
|
Integer coverUp = null;
|
|
|
- if (body.getWdCount() != null){
|
|
|
+ if (body.getWdCount() != null) { // 拆分搜索字段:网点数量
|
|
|
if (body.getWdCount().size() == 1)
|
|
|
countDown = Integer.parseInt(body.getWdCount().get(0));
|
|
|
- else if (body.getWdCount().size() >= 2){
|
|
|
+ else if (body.getWdCount().size() >= 2) {
|
|
|
countDown = Integer.parseInt(body.getWdCount().get(0));
|
|
|
countUp = Integer.parseInt(body.getWdCount().get(1));
|
|
|
}
|
|
|
}
|
|
|
- if (body.getCoverCityCount() != null){
|
|
|
- if (body.getCoverCityCount().size() == 1){
|
|
|
+ if (body.getCoverCityCount() != null) { // 拆分搜索字段:覆盖城市数
|
|
|
+ if (body.getCoverCityCount().size() == 1) {
|
|
|
coverDown = Integer.parseInt(body.getCoverCityCount().get(0));
|
|
|
- }else if (body.getCoverCityCount().size() >= 2){
|
|
|
+ } else if (body.getCoverCityCount().size() >= 2) {
|
|
|
coverDown = Integer.parseInt(body.getCoverCityCount().get(0));
|
|
|
coverUp = Integer.parseInt(body.getCoverCityCount().get(1));
|
|
|
}
|
|
|
}
|
|
|
-// System.out.println(countDown+","+countUp);
|
|
|
-// System.out.println(coverDown+","+coverUp);
|
|
|
- List<BrandSearch> brandSearches = brandMapper.searchSearchByMulti(text, industryCode, countUp, countDown, coverUp, coverDown);
|
|
|
- if (userId == null || userId.equals("")){
|
|
|
- for (BrandSearch search : brandSearches){
|
|
|
+ List<BrandSearch> brandSearches = brandMapper.searchSearchByMulti(body.getText(), industryCode, countUp, countDown, coverUp, coverDown);
|
|
|
+ // 赋予attention字段信息,0:未关注;1:已关注
|
|
|
+ if (userId == null || userId.equals("")) { // 用户未登录或无效用户id,都是未关注状态
|
|
|
+ for (BrandSearch search : brandSearches) {
|
|
|
+ QueryWrapper<Enterprise> enterpriseQueryWrapper = new QueryWrapper<>();
|
|
|
+ enterpriseQueryWrapper.eq("enterprise_usci", search.getEnterpriseName());
|
|
|
+ Enterprise enterprise = enterpriseMapper.selectOne(enterpriseQueryWrapper);
|
|
|
+ search.setEnterpriseName(enterprise != null ? enterprise.getEnterpriseName() : null);
|
|
|
search.setAttention(0);
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else { // 否则,根据用户潜客池,赋予字段相应的值
|
|
|
List<AttentionPool> pools = attentionPoolDao.searchByMulti(null, userId);
|
|
|
- Map<String ,String> map = new HashMap<>();
|
|
|
- for (AttentionPool pool : pools){
|
|
|
- map.put(pool.getBrandId(),"1");
|
|
|
- }
|
|
|
- for (BrandSearch search : brandSearches){
|
|
|
- if (map.get(search.getBrandId()) == null){
|
|
|
- search.setAttention(0);
|
|
|
- }else {
|
|
|
- search.setAttention(1);
|
|
|
- }
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ for (AttentionPool pool : pools)
|
|
|
+ map.put(pool.getBrandId(), "1");
|
|
|
+ for (BrandSearch search : brandSearches) {
|
|
|
+ QueryWrapper<Enterprise> enterpriseQueryWrapper = new QueryWrapper<>();
|
|
|
+ enterpriseQueryWrapper.eq("enterprise_usci", search.getEnterpriseName());
|
|
|
+ Enterprise enterprise = enterpriseMapper.selectOne(enterpriseQueryWrapper);
|
|
|
+ search.setEnterpriseName(enterprise != null ? enterprise.getEnterpriseName() : null);
|
|
|
+ search.setAttention(map.get(search.getBrandId()) == null ? 0 : 1);
|
|
|
}
|
|
|
}
|
|
|
return new PageInfo(brandSearches);
|
|
@@ -319,247 +303,97 @@ public class BrandServiceImpl implements BrandService {
|
|
|
|
|
|
@Override
|
|
|
public List<BrandTotal> searchTotal(Integer pageSize) {
|
|
|
- List<BrandStatistics> list = brandStatisticsMapper.searchList();
|
|
|
- if (list.isEmpty())
|
|
|
+ QueryWrapper<BrandStatistics> statisticsQueryWrapper = new QueryWrapper<>();
|
|
|
+ statisticsQueryWrapper.orderByDesc("total");
|
|
|
+ List<BrandStatistics> list = brandStatisticsMapper.selectList(statisticsQueryWrapper);
|
|
|
+ if (list == null || list.isEmpty())
|
|
|
return new ArrayList<>();
|
|
|
+
|
|
|
+ // 取pageSize大小的数量,默认10条
|
|
|
List<BrandTotal> tList = new ArrayList<>();
|
|
|
- if (pageSize == null)
|
|
|
- pageSize = 10;
|
|
|
+ if (pageSize == null) pageSize = 10;
|
|
|
int index = 0;
|
|
|
- for (BrandStatistics bs : list){
|
|
|
+ for (BrandStatistics bs : list) {
|
|
|
if (index >= pageSize)
|
|
|
break;
|
|
|
- BrandTotal bt = new BrandTotal();
|
|
|
- bt.setBrandId(bs.getBrandId());
|
|
|
- bt.setBrandName(bs.getBrandName());
|
|
|
- bt.setTotal(bs.getTotal());
|
|
|
- bt.setUpdateTime(bs.getUpdateTime());
|
|
|
- tList.add(bt);
|
|
|
+ tList.add(new BrandTotal(bs));
|
|
|
index++;
|
|
|
}
|
|
|
return tList;
|
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
-// public BStoreData searchAvgScoreByBrandId(String brandId) {
|
|
|
-// Brand brand = brandMapper.searchById(brandId);
|
|
|
-// if (brand == null)
|
|
|
-// return null;
|
|
|
-// BStoreData bStoreData = new BStoreData();
|
|
|
-// bStoreData.setBrandName(brand.getBrandName());
|
|
|
-// List<BrandZone> zones = brandZoneMapper.searchByBrandId(brandId);
|
|
|
-// if (zones.isEmpty())
|
|
|
-// return null;
|
|
|
-// List<Info> infos = new ArrayList<>();
|
|
|
-// wdInfoService.setAddrMap();
|
|
|
-// for (BrandZone bz : zones){
|
|
|
-// Info info = new Info();
|
|
|
-// info.setAddrCode(bz.getAddrCode());
|
|
|
-// info.setAddrName(wdInfoService.addrMap.get(bz.getAddrCode()));
|
|
|
-// info.setAvgScore(bz.getAvgScore());
|
|
|
-// infos.add(info);
|
|
|
-// }
|
|
|
-// bStoreData.setInfo(infos);
|
|
|
-// return bStoreData;
|
|
|
-// }
|
|
|
-
|
|
|
-// @Override
|
|
|
-// public List<BrandAddrDistribution> searchAddrDistribution(List<String> addrCodes) {
|
|
|
-// List<BrandAddrDistribution> list = brandZoneMapper.searchByAddrCodeGroup(addrCodes);
|
|
|
-// wdInfoService.setAddrMap();
|
|
|
-// for (BrandAddrDistribution dis : list){
|
|
|
-// dis.setAddrName(wdInfoService.addrMap.get(dis.getAddrCode()));
|
|
|
-// }
|
|
|
-// return list;
|
|
|
-// }
|
|
|
-
|
|
|
@Override
|
|
|
public List<BrandGeoLabelBo> searchGeoLabel(String brandId) {
|
|
|
List<BrandGeoLabelBo> bos = new ArrayList<>();
|
|
|
-
|
|
|
// 查询门店
|
|
|
QueryWrapper<StoreWd> storeWdQueryWrapper = new QueryWrapper<>();
|
|
|
- storeWdQueryWrapper.eq("brand_id",brandId);
|
|
|
+ storeWdQueryWrapper.eq("brand_id", brandId);
|
|
|
List<StoreWd> storeWds = storeWdDao.selectList(storeWdQueryWrapper);
|
|
|
- if (storeWds.size() == 0)
|
|
|
+ if (storeWds.isEmpty())
|
|
|
return bos;
|
|
|
-
|
|
|
- // 查询门店标签
|
|
|
+// 查询门店标签
|
|
|
int count = storeWds.size(); // 总数,用于做比率
|
|
|
+ // 将门店列表中的网点id抽取出来
|
|
|
List<String> wdIds = new ArrayList<>();
|
|
|
- for (StoreWd storeWd : storeWds){
|
|
|
- wdIds.add(storeWd.getWdId());
|
|
|
- }
|
|
|
+ storeWds.forEach(storeWd -> wdIds.add(storeWd.getWdId()));
|
|
|
+ // 查询网点基本信息列表
|
|
|
QueryWrapper<WdInfo> wdInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- wdInfoQueryWrapper.in("wd_id",wdIds);
|
|
|
+ wdInfoQueryWrapper.in("wd_id", wdIds);
|
|
|
List<WdInfo> wdInfos = wdInfoDao.selectList(wdInfoQueryWrapper);
|
|
|
-// System.out.println(wdIds);
|
|
|
-// QueryWrapper<WdTopologicalInfo> infoQueryWrapper = new QueryWrapper<>();
|
|
|
-// List<String> wdIds = new ArrayList<>();
|
|
|
-// for (StoreWd storeWd : storeWds){
|
|
|
-// wdIds.add(storeWd.getWdId());
|
|
|
-// }
|
|
|
-// infoQueryWrapper.eq("radius",1000).and(info -> {
|
|
|
-// info.in("center_wd_id",wdIds);
|
|
|
-// });
|
|
|
-// List<WdTopologicalInfo> infos = wdTopologicalInfoDao.selectList(infoQueryWrapper);
|
|
|
-
|
|
|
// 统计标签
|
|
|
- Map<String,Integer> typeMap = new HashMap<>();
|
|
|
- for (WdInfo wdInfo : wdInfos){
|
|
|
+ Map<String, Integer> typeMap = new HashMap<>();
|
|
|
+ for (WdInfo wdInfo : wdInfos) {
|
|
|
List<String> wdTag = wdRedisStoreage.getWdTag(wdInfo);
|
|
|
-// System.out.println(wdTag);
|
|
|
- for (String tag : wdTag){
|
|
|
- if (typeMap.get(tag) != null){
|
|
|
- typeMap.replace(tag,typeMap.get(tag)+1);
|
|
|
+ for (String tag : wdTag) {
|
|
|
+ if (typeMap.get(tag) != null) {
|
|
|
+ typeMap.replace(tag, typeMap.get(tag) + 1);
|
|
|
continue;
|
|
|
}
|
|
|
- typeMap.put(tag,1);
|
|
|
+ typeMap.put(tag, 1);
|
|
|
}
|
|
|
}
|
|
|
-// System.out.println(typeMap);
|
|
|
-
|
|
|
-// for (WdTopologicalInfo info : infos){
|
|
|
-// String tag = info.getTag();
|
|
|
-// String[] tags = tag.split(";");
|
|
|
-// for (String t : tags){
|
|
|
-// String[] split = t.split(":");
|
|
|
-// if (split.length < 2)
|
|
|
-// continue;
|
|
|
-// if (typeMap.get(split[0]) != null){
|
|
|
-// typeMap.replace(split[0],typeMap.get(split[0])+Integer.parseInt(split[1]));
|
|
|
-// }
|
|
|
-// typeMap.put(split[0],Integer.parseInt(split[1]));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// Set<String> keySet = typeMap.keySet();
|
|
|
-// QueryWrapper<TypeBy> typeByQueryWrapper = new QueryWrapper<>();
|
|
|
-// typeByQueryWrapper.in("type_code_by",keySet).and(typeByQueryWrapper1 -> {
|
|
|
-// typeByQueryWrapper1.ne("mid_category","");
|
|
|
-// }).and(typeByQueryWrapper1 -> {
|
|
|
-// typeByQueryWrapper1.ne("sub_category","");
|
|
|
-// });
|
|
|
-
|
|
|
- // 排序
|
|
|
-// Map<String,Integer> sortMap = new LinkedHashMap<>();
|
|
|
-// typeMap.entrySet()
|
|
|
-// .stream().sorted(Map.Entry.comparingByValue())
|
|
|
-// .forEachOrdered(x -> sortMap.put(x.getKey(),x.getValue()));
|
|
|
- List<Map.Entry<String,Integer>> sortMap = new ArrayList<>(typeMap.entrySet());
|
|
|
+ // 排序标签统计结果
|
|
|
+ List<Map.Entry<String, Integer>> sortMap = new ArrayList<>(typeMap.entrySet());
|
|
|
Collections.sort(sortMap, new Comparator<Map.Entry<String, Integer>>() {
|
|
|
@Override
|
|
|
public int compare(Map.Entry<String, Integer> t1, Map.Entry<String, Integer> t2) {
|
|
|
return t2.getValue().compareTo(t1.getValue()); // 降序
|
|
|
}
|
|
|
});
|
|
|
- // 获取前10项
|
|
|
+ // 获取前10项标签统计结果
|
|
|
List<String> searchList = new ArrayList<>();
|
|
|
- for (int i=0;i<sortMap.size();i++){
|
|
|
- // System.out.println(sortMap.get(i).getKey()+" "+sortMap.get(i).getValue());
|
|
|
+ for (int i = 0; i < sortMap.size(); i++) {
|
|
|
searchList.add(sortMap.get(i).getKey());
|
|
|
if (searchList.size() >= 10)
|
|
|
break;
|
|
|
}
|
|
|
-// System.out.println(searchList);
|
|
|
- // 查询标签
|
|
|
-// QueryWrapper<TypeBy> typeByQueryWrapper = new QueryWrapper<>();
|
|
|
-// typeByQueryWrapper.in("type_code_by",searchList);
|
|
|
-// List<TypeBy> typeByList = typeByDao.selectList(typeByQueryWrapper);
|
|
|
// 赋值
|
|
|
- for (String s : searchList){
|
|
|
- BrandGeoLabelBo bo = new BrandGeoLabelBo();
|
|
|
- bo.setName(s);
|
|
|
- bo.setTotal(typeMap.get(s));
|
|
|
- float ratio = (float) bo.getTotal()/count;
|
|
|
- bo.setRatio((ratio*100) + "%");
|
|
|
- bos.add(bo);
|
|
|
- }
|
|
|
-// for (TypeBy typeBy : typeByList){
|
|
|
-// BrandGeoLabelBo bo = new BrandGeoLabelBo();
|
|
|
-// bo.setCode(typeBy.getTypeCodeBy());
|
|
|
-// bo.setTotal(typeMap.get(typeBy.getTypeCodeBy()));
|
|
|
-// if (!typeBy.getSubCategory().equals("")){
|
|
|
-// bo.setName(typeBy.getSubCategory());
|
|
|
-// }else if (!typeBy.getMidCategory().equals("")){
|
|
|
-// bo.setName(typeBy.getMidCategory());
|
|
|
-// }else{
|
|
|
-// bo.setName(typeBy.getBigCategory());
|
|
|
-// }
|
|
|
-// float ratio = (float) bo.getTotal()/count;
|
|
|
-// bo.setRatio((ratio*100) + "%");
|
|
|
-// bos.add(bo);
|
|
|
-// }
|
|
|
-// bos.sort(new Comparator<BrandGeoLabelBo>() {
|
|
|
-// @Override
|
|
|
-// public int compare(BrandGeoLabelBo t1, BrandGeoLabelBo t2) {
|
|
|
-// return t2.getTotal().compareTo(t1.getTotal());
|
|
|
-// }
|
|
|
-// });
|
|
|
+ searchList.forEach(s -> bos.add(new BrandGeoLabelBo(s, typeMap.get(s), count)));
|
|
|
return bos;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public List<BrandOpcloseVo> searchOpenByMulti(List<String> typeCodes, LocalDateTime startTime, LocalDateTime endTime) {
|
|
|
- List<String> codes = new ArrayList<>();
|
|
|
- if (typeCodes != null){
|
|
|
- for (String code : typeCodes){
|
|
|
- codes.add(code);
|
|
|
- List<String> otherTypeBy = categoryUtil.getAllOtherTypeBy(code);
|
|
|
- codes.addAll(otherTypeBy);
|
|
|
- }
|
|
|
- }else{
|
|
|
- codes = null;
|
|
|
- }
|
|
|
- List<BrandOpcloseVo> vos = storeOpcloseDao.selectOpenByMulti(codes, startTime, endTime);
|
|
|
- return vos.subList(0, 9);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public List<BrandOpcloseVo> searchCloseByMulti(List<String> typeCodes, LocalDateTime startTime, LocalDateTime endTime) {
|
|
|
- List<String> codes = new ArrayList<>();
|
|
|
- if (typeCodes != null){
|
|
|
- for (String code : typeCodes){
|
|
|
- codes.add(code);
|
|
|
- List<String> otherTypeBy = categoryUtil.getAllOtherTypeBy(code);
|
|
|
- codes.addAll(otherTypeBy);
|
|
|
- }
|
|
|
- }else{
|
|
|
- codes = null;
|
|
|
- }
|
|
|
- List<BrandOpcloseVo> vos = storeOpcloseDao.selectCloseByMulti(codes, startTime, endTime);
|
|
|
- return vos.subList(0,9);
|
|
|
- }
|
|
|
-
|
|
|
@Override
|
|
|
public List<BrandEvolveVo> searchEvolveByMulti(List<String> addrCodes, List<String> typeCodes, List<String> brandIds) {
|
|
|
+ // 补齐地址码
|
|
|
List<String> addrs = new ArrayList<>();
|
|
|
- if (addrCodes != null){
|
|
|
- for (String code : addrCodes){
|
|
|
- addrs.add(code);
|
|
|
- List<String> otherAddrCode = categoryUtil.getAllOtherAddrCode(code);
|
|
|
- addrs.addAll(otherAddrCode);
|
|
|
- }
|
|
|
- }else{
|
|
|
+ if (addrCodes != null || !addrCodes.isEmpty()) {
|
|
|
+ for (String code : addrCodes)
|
|
|
+ addrs.addAll(categoryUtil.getAllOtherAddrCode(code));
|
|
|
+ } else
|
|
|
addrs = null;
|
|
|
- }
|
|
|
+ // 补齐网点分类(犇云)
|
|
|
List<String> types = new ArrayList<>();
|
|
|
- if (typeCodes != null){
|
|
|
- for (String code : typeCodes){
|
|
|
- types.add(code);
|
|
|
- List<String> otherTypeBy = categoryUtil.getAllOtherTypeBy(code);
|
|
|
- types.addAll(otherTypeBy);
|
|
|
- }
|
|
|
- }else{
|
|
|
+ if (typeCodes != null || !typeCodes.isEmpty()) {
|
|
|
+ for (String code : typeCodes)
|
|
|
+ types.addAll(categoryUtil.getAllOtherTypeBy(code));
|
|
|
+ } else
|
|
|
types = null;
|
|
|
- }
|
|
|
+
|
|
|
List<BrandEvolveVo> vos = new ArrayList<>();
|
|
|
- for (String brandId : brandIds){
|
|
|
+ for (String brandId : brandIds) {
|
|
|
List<BrandEvolveVo> evolveVos = brandEvolveDao.selectByMulti(addrs, types, brandId);
|
|
|
- for (int i=0; i<evolveVos.size(); i++){
|
|
|
- if (i == 0)
|
|
|
- continue;
|
|
|
- evolveVos.get(i).setTotal(evolveVos.get(i-1).getTotal()+evolveVos.get(i).getTotal());
|
|
|
- }
|
|
|
+ for (int i = 1; i < evolveVos.size(); i++)
|
|
|
+ evolveVos.get(i).setTotal(evolveVos.get(i - 1).getTotal() + evolveVos.get(i).getTotal());
|
|
|
vos.addAll(evolveVos);
|
|
|
}
|
|
|
return vos;
|
|
@@ -567,149 +401,129 @@ public class BrandServiceImpl implements BrandService {
|
|
|
|
|
|
@Override
|
|
|
public Map<String, List<BrandEvolveVo>> searchEvolveByMulti2Map(List<String> addrCodes, List<String> typeCodes, List<String> brandIds) {
|
|
|
+ // 补齐地址码
|
|
|
List<String> addrs = new ArrayList<>();
|
|
|
- if (addrCodes != null){
|
|
|
- for (String code : addrCodes){
|
|
|
- addrs.add(code);
|
|
|
- List<String> otherAddrCode = categoryUtil.getAllOtherAddrCode(code);
|
|
|
- addrs.addAll(otherAddrCode);
|
|
|
- }
|
|
|
- }else{
|
|
|
+ if (addrCodes != null || !addrCodes.isEmpty()) {
|
|
|
+ for (String code : addrCodes)
|
|
|
+ addrs.addAll(categoryUtil.getAllOtherAddrCode(code));
|
|
|
+ } else
|
|
|
addrs = null;
|
|
|
- }
|
|
|
+ // 补齐网点分类(犇云)
|
|
|
List<String> types = new ArrayList<>();
|
|
|
- if (typeCodes != null){
|
|
|
- for (String code : typeCodes){
|
|
|
- types.add(code);
|
|
|
- List<String> otherTypeBy = categoryUtil.getAllOtherTypeBy(code);
|
|
|
- types.addAll(otherTypeBy);
|
|
|
- }
|
|
|
- }else{
|
|
|
+ if (typeCodes != null || !typeCodes.isEmpty()) {
|
|
|
+ for (String code : typeCodes)
|
|
|
+ types.addAll(categoryUtil.getAllOtherTypeBy(code));
|
|
|
+ } else
|
|
|
types = null;
|
|
|
- }
|
|
|
+
|
|
|
List<BrandEvolveVo> vos = new ArrayList<>();
|
|
|
- for (String brandId : brandIds){
|
|
|
+ // 向后累和
|
|
|
+ for (String brandId : brandIds) {
|
|
|
List<BrandEvolveVo> evolveVos = brandEvolveDao.selectByMulti(addrs, types, brandId);
|
|
|
- for (int i=0; i<evolveVos.size(); i++){
|
|
|
- if (i == 0)
|
|
|
- continue;
|
|
|
- evolveVos.get(i).setTotal(evolveVos.get(i-1).getTotal()+evolveVos.get(i).getTotal());
|
|
|
- }
|
|
|
+ for (int i = 1; i < evolveVos.size(); i++)
|
|
|
+ evolveVos.get(i).setTotal(evolveVos.get(i - 1).getTotal() + evolveVos.get(i).getTotal());
|
|
|
vos.addAll(evolveVos);
|
|
|
}
|
|
|
- Map<String,List<BrandEvolveVo>> times = new HashMap<>();
|
|
|
- for (int i = 0; i < 12; i++){
|
|
|
+ // 构造时间映射对象
|
|
|
+ Map<String, List<BrandEvolveVo>> times = new HashMap<>();
|
|
|
+ for (int i = 0; i < 12; i++) {
|
|
|
List<BrandEvolveVo> evos = new ArrayList<>();
|
|
|
- times.put(LocalDateTime.now(ZoneId.of("Asia/Shanghai")).plusMonths(-i).format(DateTimeFormatter.ofPattern("yyyy-MM")),evos);
|
|
|
+ times.put(LocalDateTime.now(ZoneId.of("Asia/Shanghai")).plusMonths(-i).format(DateTimeFormatter.ofPattern("yyyy-MM")), evos);
|
|
|
}
|
|
|
- for (BrandEvolveVo vo : vos){
|
|
|
- if (times.get(vo.getTime()) != null){
|
|
|
+ // 向时间映射对象中赋值
|
|
|
+ vos.forEach(vo -> {
|
|
|
+ if (times.get(vo.getTime()) != null) {
|
|
|
List<BrandEvolveVo> brandEvolveVos = times.get(vo.getTime());
|
|
|
brandEvolveVos.add(vo);
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
return times;
|
|
|
}
|
|
|
|
|
|
- public Integer timeUtil(String time){
|
|
|
+ public Integer timeUtil(String time) {
|
|
|
String[] split = time.split(":");
|
|
|
int hour = Integer.parseInt(split[0]);
|
|
|
int min = Integer.parseInt(split[1]);
|
|
|
- return hour*100+min;
|
|
|
+ return hour * 100 + min;
|
|
|
}
|
|
|
- public int compareTime(String time1, String time2){
|
|
|
- int result = timeUtil(time1).compareTo(timeUtil(time2));
|
|
|
-// if (result > 0)
|
|
|
-// System.out.println(time1 + " > " + time2);
|
|
|
-// if (result == 0)
|
|
|
-// System.out.println(time1 + " = " + time2);
|
|
|
-// if (result < 0)
|
|
|
-// System.out.println(time1 + " < " + time2);
|
|
|
- return result;
|
|
|
+
|
|
|
+ public int compareTime(String time1, String time2) {
|
|
|
+ return timeUtil(time1).compareTo(timeUtil(time2));
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public List<OpcloseTimeVo> searchOpenTims(List<String> brandIds, List<String> addrCodes, List<String> typeCodeBys) {
|
|
|
+ // 补齐地址码
|
|
|
List<String> addrs = new ArrayList<>();
|
|
|
- if (addrCodes != null){
|
|
|
- if (addrCodes.size() != 0)
|
|
|
- for (String addr : addrCodes){
|
|
|
- List<String> otherAddrCode = categoryUtil.getAllOtherAddrCode(addr);
|
|
|
- addrs.addAll(otherAddrCode);
|
|
|
- }
|
|
|
- else
|
|
|
- addrs = null;
|
|
|
- }else
|
|
|
+ if (addrCodes != null || !addrCodes.isEmpty()) {
|
|
|
+ for (String addr : addrCodes)
|
|
|
+ addrs.addAll(categoryUtil.getAllOtherAddrCode(addr));
|
|
|
+ } else
|
|
|
addrs = null;
|
|
|
+
|
|
|
+ // 补齐网点分类(犇云)
|
|
|
List<String> types = new ArrayList<>();
|
|
|
- if (typeCodeBys != null){
|
|
|
- if (typeCodeBys.size() != 0)
|
|
|
- for (String type : typeCodeBys){
|
|
|
- List<String> otherTypeBy = categoryUtil.getAllOtherTypeBy(type);
|
|
|
- types.addAll(otherTypeBy);
|
|
|
- }
|
|
|
- else
|
|
|
- types = null;
|
|
|
- }else
|
|
|
+ if (typeCodeBys != null || !typeCodeBys.isEmpty()) {
|
|
|
+ for (String type : typeCodeBys)
|
|
|
+ types.addAll(categoryUtil.getAllOtherTypeBy(type));
|
|
|
+ } else
|
|
|
types = null;
|
|
|
+
|
|
|
+ // 合并,计算
|
|
|
List<OpcloseTimeVo> vos = storeWdOpcloseDao.selectBrandOpenTimes(brandIds, addrs, types);
|
|
|
List<OpcloseTimeVo> rvos = new ArrayList<>();
|
|
|
- for (int i = 0;i < 24; i+=2){
|
|
|
+ for (int i = 0; i < 24; i += 2) {
|
|
|
OpcloseTimeVo vo = new OpcloseTimeVo();
|
|
|
- vo.setTime(i+":00~"+(i+2)+":00");
|
|
|
+ vo.setTime(i + ":00~" + (i + 2) + ":00");
|
|
|
vo.setCount(0);
|
|
|
rvos.add(vo);
|
|
|
}
|
|
|
- for (OpcloseTimeVo vo : vos){
|
|
|
- for (OpcloseTimeVo rvo : rvos){
|
|
|
+ vos.forEach(vo -> {
|
|
|
+ for (OpcloseTimeVo rvo : rvos) {
|
|
|
String[] times = rvo.getTime().split("~");
|
|
|
- if (compareTime(vo.getTime(),times[0]) < 0 || compareTime(times[1],vo.getTime()) < 0)
|
|
|
+ if (compareTime(vo.getTime(), times[0]) < 0 || compareTime(times[1], vo.getTime()) < 0)
|
|
|
continue;
|
|
|
rvo.setCount(rvo.getCount() + vo.getCount());
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
return rvos;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<OpcloseTimeVo> searchCloseTims(List<String> brandIds, List<String> addrCodes, List<String> typeCodeBys) {
|
|
|
+ // 补齐地址码
|
|
|
List<String> addrs = new ArrayList<>();
|
|
|
- if (addrCodes != null){
|
|
|
- if (addrCodes.size() != 0)
|
|
|
- for (String addr : addrCodes){
|
|
|
- List<String> otherAddrCode = categoryUtil.getAllOtherAddrCode(addr);
|
|
|
- addrs.addAll(otherAddrCode);
|
|
|
- }
|
|
|
- else
|
|
|
- addrs = null;
|
|
|
- }else
|
|
|
+ if (addrCodes != null || !addrCodes.isEmpty()) {
|
|
|
+ for (String addr : addrCodes)
|
|
|
+ addrs.addAll(categoryUtil.getAllOtherAddrCode(addr));
|
|
|
+ } else
|
|
|
addrs = null;
|
|
|
+
|
|
|
+ // 补齐网点分类(犇云)
|
|
|
List<String> types = new ArrayList<>();
|
|
|
- if (typeCodeBys != null){
|
|
|
- if (typeCodeBys.size() != 0)
|
|
|
- for (String type : typeCodeBys){
|
|
|
- List<String> otherTypeBy = categoryUtil.getAllOtherTypeBy(type);
|
|
|
- types.addAll(otherTypeBy);
|
|
|
- }
|
|
|
- else
|
|
|
- types = null;
|
|
|
- }else
|
|
|
+ if (typeCodeBys != null || !typeCodeBys.isEmpty()) {
|
|
|
+ for (String type : typeCodeBys)
|
|
|
+ types.addAll(categoryUtil.getAllOtherTypeBy(type));
|
|
|
+ } else
|
|
|
types = null;
|
|
|
+
|
|
|
+ // 合并,计算
|
|
|
List<OpcloseTimeVo> vos = storeWdOpcloseDao.selectBrandCloseTimes(brandIds, addrs, types);
|
|
|
List<OpcloseTimeVo> rvos = new ArrayList<>();
|
|
|
- for (int i = 0;i < 24; i+=2){
|
|
|
+ for (int i = 0; i < 24; i += 2) {
|
|
|
OpcloseTimeVo vo = new OpcloseTimeVo();
|
|
|
- vo.setTime(i+":00~"+(i+2)+":00");
|
|
|
+ vo.setTime(i + ":00~" + (i + 2) + ":00");
|
|
|
vo.setCount(0);
|
|
|
rvos.add(vo);
|
|
|
}
|
|
|
- for (OpcloseTimeVo vo : vos){
|
|
|
- for (OpcloseTimeVo rvo : rvos){
|
|
|
+ vos.forEach(vo -> {
|
|
|
+ for (OpcloseTimeVo rvo : rvos) {
|
|
|
String[] times = rvo.getTime().split("~");
|
|
|
- if (compareTime(vo.getTime(),times[0]) < 0 || compareTime(times[1],vo.getTime()) < 0)
|
|
|
+ if (compareTime(vo.getTime(), times[0]) < 0 || compareTime(times[1], vo.getTime()) < 0)
|
|
|
continue;
|
|
|
rvo.setCount(rvo.getCount() + vo.getCount());
|
|
|
}
|
|
|
- }
|
|
|
+ });
|
|
|
return rvos;
|
|
|
}
|
|
|
}
|