|
@@ -1,26 +1,22 @@
|
|
package com.ruoyi.demo.service.impl;
|
|
package com.ruoyi.demo.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.ruoyi.demo.constant.RedisContant;
|
|
import com.ruoyi.demo.constant.RedisContant;
|
|
-import com.ruoyi.demo.entity.Brand;
|
|
|
|
-import com.ruoyi.demo.entity.ManageType;
|
|
|
|
-import com.ruoyi.demo.entity.StoreWd;
|
|
|
|
-import com.ruoyi.demo.entity.WdInfo;
|
|
|
|
|
|
+import com.ruoyi.demo.entity.*;
|
|
import com.ruoyi.demo.entity.bo.Histogram;
|
|
import com.ruoyi.demo.entity.bo.Histogram;
|
|
import com.ruoyi.demo.entity.bo.StoreWdCategoryCount;
|
|
import com.ruoyi.demo.entity.bo.StoreWdCategoryCount;
|
|
import com.ruoyi.demo.entity.bo.StoreWdCategoryCountBody;
|
|
import com.ruoyi.demo.entity.bo.StoreWdCategoryCountBody;
|
|
import com.ruoyi.demo.entity.vo.ChannelAnalyseAceeptVo;
|
|
import com.ruoyi.demo.entity.vo.ChannelAnalyseAceeptVo;
|
|
import com.ruoyi.demo.entity.vo.ChannelMapAceeptVo;
|
|
import com.ruoyi.demo.entity.vo.ChannelMapAceeptVo;
|
|
import com.ruoyi.demo.entity.vo.TagAnalyse;
|
|
import com.ruoyi.demo.entity.vo.TagAnalyse;
|
|
-import com.ruoyi.demo.mapper.BrandMapper;
|
|
|
|
-import com.ruoyi.demo.mapper.StoreWdDao;
|
|
|
|
-import com.ruoyi.demo.mapper.WdInfoDao;
|
|
|
|
-import com.ruoyi.demo.mapper.WdTopologicalInfoDao;
|
|
|
|
|
|
+import com.ruoyi.demo.mapper.*;
|
|
import com.ruoyi.demo.service.ChannelAnalyseService;
|
|
import com.ruoyi.demo.service.ChannelAnalyseService;
|
|
import com.ruoyi.demo.utils.InitMapUtil;
|
|
import com.ruoyi.demo.utils.InitMapUtil;
|
|
import com.ruoyi.demo.utils.WdRedisStoreage;
|
|
import com.ruoyi.demo.utils.WdRedisStoreage;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
import org.springframework.data.geo.Circle;
|
|
import org.springframework.data.geo.Circle;
|
|
@@ -41,10 +37,13 @@ import java.util.concurrent.ExecutionException;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.concurrent.ExecutorService;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
+@Slf4j
|
|
@Service
|
|
@Service
|
|
@Transactional
|
|
@Transactional
|
|
public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private AddrCategoryDao addrCategoryDao;
|
|
@Autowired
|
|
@Autowired
|
|
WdInfoDao wdInfoDao;
|
|
WdInfoDao wdInfoDao;
|
|
|
|
|
|
@@ -69,9 +68,14 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
ExecutorService executor;
|
|
ExecutorService executor;
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 网点城市等级分布统计
|
|
|
|
+ * @param channelMapAceeptVo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public HashMap cityTier(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
public HashMap cityTier(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
- //1.统计结果
|
|
|
|
|
|
+ //1.初始化统计结果
|
|
HashMap<String, Long> result = new HashMap<>();
|
|
HashMap<String, Long> result = new HashMap<>();
|
|
result.put("一线", 0L);
|
|
result.put("一线", 0L);
|
|
result.put("新一线", 0L);
|
|
result.put("新一线", 0L);
|
|
@@ -82,150 +86,47 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
result.put("其他", 0L);
|
|
result.put("其他", 0L);
|
|
|
|
|
|
|
|
|
|
- //1.获取所有符合条件的网点信息
|
|
|
|
|
|
+ //2.获取所有符合条件的网点信息
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.select("addr_code","count(*) as audit");
|
|
queryWrapper.select("addr_code","count(*) as audit");
|
|
- assembleQueryWrapper(queryWrapper,channelMapAceeptVo);
|
|
|
|
|
|
+ assembleQueryWrapper(queryWrapper,channelMapAceeptVo); //封装过滤条件
|
|
queryWrapper.groupBy("addr_code");
|
|
queryWrapper.groupBy("addr_code");
|
|
List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
|
|
List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
|
|
|
|
|
|
|
|
+ //3.统计各个城市等级的网点数量
|
|
for (WdInfo wdInfo : wdInfos) {
|
|
for (WdInfo wdInfo : wdInfos) {
|
|
|
|
+ //通过 网点区码 得到 该网点属于几线城市 例如:4509010000 -> 二线
|
|
String initCityTierMap = initMapUtil.getInitCityTierMap(wdInfo.getAddrCode());
|
|
String initCityTierMap = initMapUtil.getInitCityTierMap(wdInfo.getAddrCode());
|
|
|
|
+
|
|
if (initCityTierMap != null) {
|
|
if (initCityTierMap != null) {
|
|
result.put(initCityTierMap, result.get(initCityTierMap) + wdInfo.getAudit());
|
|
result.put(initCityTierMap, result.get(initCityTierMap) + wdInfo.getAudit());
|
|
} else
|
|
} else
|
|
result.put("其他", result.get("其他") + wdInfo.getAudit());
|
|
result.put("其他", result.get("其他") + wdInfo.getAudit());
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 品牌列表
|
|
|
|
+ * @param channelAnalyseAceeptVo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
- public PageInfo<Brand> brandList(ChannelAnalyseAceeptVo channelAnalyseAceeptVo) {
|
|
|
|
- String text = "";
|
|
|
|
- if (channelAnalyseAceeptVo.getSearchText() != null)
|
|
|
|
- text = channelAnalyseAceeptVo.getSearchText();
|
|
|
|
- PageHelper.startPage(channelAnalyseAceeptVo.getPageNum(), channelAnalyseAceeptVo.getPageSize());
|
|
|
|
- List<Brand> brands = brandMapper.searchList(text);
|
|
|
|
- PageInfo<Brand> pageInfo = new PageInfo<>(brands);
|
|
|
|
- return pageInfo;
|
|
|
|
|
|
+ public Page<Brand> brandList(ChannelAnalyseAceeptVo channelAnalyseAceeptVo) {
|
|
|
|
+ QueryWrapper<Brand> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ if (channelAnalyseAceeptVo.getSearchText() != null && !channelAnalyseAceeptVo.getSearchText().equals(""))
|
|
|
|
+ queryWrapper.like("brand_name",channelAnalyseAceeptVo.getSearchText());
|
|
|
|
+
|
|
|
|
+ Page<Brand> page = new Page<>();
|
|
|
|
+ page.setSize(channelAnalyseAceeptVo.getPageSize());
|
|
|
|
+ page.setCurrent(channelAnalyseAceeptVo.getPageNum());
|
|
|
|
+ Page<Brand> brandPage = brandMapper.selectPage(page, queryWrapper);
|
|
|
|
+ return brandPage;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- //版本1
|
|
|
|
-// @Override
|
|
|
|
-// public HashMap<String, Object> tagAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
|
|
-// //1.根据条件的到位网点信息
|
|
|
|
-// QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
|
|
-// queryWrapper.select("wd_id");
|
|
|
|
-// assembleQueryWrapper(queryWrapper,channelMapAceeptVo);
|
|
|
|
-// queryWrapper.and(queryWrapper2 ->{
|
|
|
|
-// queryWrapper2.eq("show_delete",0);
|
|
|
|
-// });
|
|
|
|
-// List<WdInfo> queryWd = wdInfoDao.selectList(queryWrapper);
|
|
|
|
-//
|
|
|
|
-// //2.获取周边标签
|
|
|
|
-// List<String> collect = queryWd.stream().map(item -> {
|
|
|
|
-// return RedisContant.WD_TAG + "_" + item.getWdId();
|
|
|
|
-// }).collect(Collectors.toList());
|
|
|
|
-//
|
|
|
|
-// //切割获取redis数据
|
|
|
|
-// int split = 60000;
|
|
|
|
-// int splitCount = collect.size()/split;
|
|
|
|
-// int p1 = 0,p2 = split;
|
|
|
|
-// ArrayList<CompletableFuture<List<List<String>>>> splitList = new ArrayList<>();
|
|
|
|
-// for (int i=1;i<=splitCount;i++){
|
|
|
|
-// if (p2 > collect.size())
|
|
|
|
-// p2 = collect.size();
|
|
|
|
-// List<String> list2 = collect.subList(p1, p2);
|
|
|
|
-// CompletableFuture<List<List<String>>> future = CompletableFuture.supplyAsync(()->{
|
|
|
|
-// return wdRedisStoreage.getWdTagList(list2);
|
|
|
|
-// },executor);
|
|
|
|
-// splitList.add(future);
|
|
|
|
-// p1 = p2;
|
|
|
|
-// p2+=split;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// //3.统计
|
|
|
|
-// Hashtable<String, Integer> hashtable = new Hashtable<>();
|
|
|
|
-// hashtable.put("total",0);
|
|
|
|
-// ArrayList<CompletableFuture<Void>> list1 = new ArrayList<>();
|
|
|
|
-// for (CompletableFuture<List<List<String>>> listCompletableFuture : splitList) {
|
|
|
|
-// try {
|
|
|
|
-// List<List<String>> lists = listCompletableFuture.get();
|
|
|
|
-// for (List<String> list : lists) {
|
|
|
|
-// if (list != null && !list.isEmpty()){
|
|
|
|
-// CompletableFuture<Void> future = CompletableFuture.runAsync(()->{
|
|
|
|
-// for (String s : list) {
|
|
|
|
-// s += "边";
|
|
|
|
-// Integer integer = hashtable.get(s);
|
|
|
|
-// if (integer == null)
|
|
|
|
-// hashtable.put(s,1);
|
|
|
|
-// else
|
|
|
|
-// hashtable.put(s,integer+1);
|
|
|
|
-// }
|
|
|
|
-// hashtable.put("total",hashtable.get("total")+1);
|
|
|
|
-// },executor);
|
|
|
|
-// list1.add(future);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// CompletableFuture.allOf(list1.toArray(new CompletableFuture[list1.size()])).join();
|
|
|
|
-// lists = null;
|
|
|
|
-// } catch (InterruptedException e) {
|
|
|
|
-// throw new RuntimeException(e);
|
|
|
|
-// } catch (ExecutionException e) {
|
|
|
|
-// throw new RuntimeException(e);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// collect = null;
|
|
|
|
-// queryWd = null;
|
|
|
|
-//
|
|
|
|
-//
|
|
|
|
-// //4.封装统计值
|
|
|
|
-// HashMap<String, Object> result = new HashMap<>();
|
|
|
|
-// List<TagAnalyse> list = new ArrayList<>();
|
|
|
|
-// Integer total = hashtable.get("total");
|
|
|
|
-// for (String s : hashtable.keySet()) {
|
|
|
|
-// if (s.equals("total"))
|
|
|
|
-// continue;
|
|
|
|
-//
|
|
|
|
-// TagAnalyse tagAnalyse = new TagAnalyse();
|
|
|
|
-// tagAnalyse.setName(s);
|
|
|
|
-// tagAnalyse.setCount(hashtable.get(s));
|
|
|
|
-// BigDecimal bigDecimal = new BigDecimal((double) tagAnalyse.getCount() / total);
|
|
|
|
-// double v = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
-// tagAnalyse.setRadio(v);
|
|
|
|
-// list.add(tagAnalyse);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// //5.对结果集进行排序
|
|
|
|
-// Collections.sort(list, new Comparator<TagAnalyse>() {
|
|
|
|
-// @Override
|
|
|
|
-// public int compare(TagAnalyse o1, TagAnalyse o2) {
|
|
|
|
-// return o2.getCount() - o1.getCount();
|
|
|
|
-// }
|
|
|
|
-// });
|
|
|
|
-//
|
|
|
|
-//
|
|
|
|
-// //5.分页返回结果集
|
|
|
|
-// int i = 1;
|
|
|
|
-// int start = 0,end = 6;
|
|
|
|
-// while(start<list.size()){
|
|
|
|
-// if(end>=list.size())
|
|
|
|
-// end = list.size();
|
|
|
|
-// result.put(""+i++,new ArrayList(list.subList(start,end)));
|
|
|
|
-// start=end;
|
|
|
|
-// end+=6;
|
|
|
|
-// }
|
|
|
|
-// result.put("pages",i-1);
|
|
|
|
-// result.put("total",total);
|
|
|
|
-// return result;
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
- //版本2
|
|
|
|
|
|
+ //TODO 待优化
|
|
@Override
|
|
@Override
|
|
public HashMap<String, Object> tagAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
public HashMap<String, Object> tagAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
//1.根据条件的到位网点信息
|
|
//1.根据条件的到位网点信息
|
|
@@ -308,6 +209,7 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //TODO 待优化
|
|
public void tagAnalyseItem(ConcurrentHashMap<String,Integer> concurrentHashMap, List<String> keys){
|
|
public void tagAnalyseItem(ConcurrentHashMap<String,Integer> concurrentHashMap, List<String> keys){
|
|
//2.获取网点周边标签,并进行统计
|
|
//2.获取网点周边标签,并进行统计
|
|
int total = 0;
|
|
int total = 0;
|
|
@@ -329,129 +231,141 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
concurrentHashMap.put("total",concurrentHashMap.get("total")+total);
|
|
concurrentHashMap.put("total",concurrentHashMap.get("total")+total);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 网点分类统计
|
|
|
|
+ * @param channelMapAceeptVo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public List<StoreWdCategoryCount> category(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
public List<StoreWdCategoryCount> category(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
-
|
|
|
|
- //2.组装条件构造器找到网点信息网点
|
|
|
|
|
|
+ //1.查询所有符合的门店网点
|
|
|
|
+ channelMapAceeptVo.setChannel(new String[]{"1"});
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.select("wd_id");
|
|
queryWrapper.select("wd_id");
|
|
- assembleQueryWrapper(queryWrapper,channelMapAceeptVo);
|
|
|
|
- queryWrapper.and(queryWrapper2 ->{
|
|
|
|
- queryWrapper2.eq("show_delete",0);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- //门店
|
|
|
|
- queryWrapper.and(queryWrapper1 -> {
|
|
|
|
- queryWrapper1.eq("wd_type_code","1");
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //5.查询周边网点结果,并统计
|
|
|
|
|
|
+ assembleQueryWrapper(queryWrapper,channelMapAceeptVo); //封装过滤条件
|
|
List<StoreWd> storeWds = storeWdDao.category(queryWrapper);
|
|
List<StoreWd> storeWds = storeWdDao.category(queryWrapper);
|
|
|
|
+
|
|
|
|
+ //2.统计各个分类的网点数量 HashMap<分类code,门店网点分类数量对象>
|
|
HashMap<String,StoreWdCategoryCount> hashMap = new HashMap<>();
|
|
HashMap<String,StoreWdCategoryCount> hashMap = new HashMap<>();
|
|
- for (StoreWd wdInfo : storeWds) {
|
|
|
|
- if(wdInfo.getManageTypeCode() == null || wdInfo.getManageTypeCode().equals(""))
|
|
|
|
|
|
+ for (StoreWd storeWd : storeWds) {
|
|
|
|
+ //分类为null、空跳过
|
|
|
|
+ if(storeWd.getManageTypeCode() == null || storeWd.getManageTypeCode().equals(""))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- String s = wdInfo.getManageTypeCode().substring(0, 4) + "00";
|
|
|
|
|
|
+ //2.1 通过 分类Code 得到 具体的分类实体
|
|
|
|
+ ManageType manageType = initMapUtil.getInitManageType(storeWd.getManageTypeCode());
|
|
|
|
+
|
|
|
|
+ //2.2 通过 分类Code 得到 门店网点分类数量对象
|
|
|
|
+ String s = storeWd.getManageTypeCode().substring(0, 4) + "00";
|
|
StoreWdCategoryCount storeWdCategoryCount = hashMap.get(s);
|
|
StoreWdCategoryCount storeWdCategoryCount = hashMap.get(s);
|
|
|
|
|
|
- ManageType initManageType = initMapUtil.getInitManageType(wdInfo.getManageTypeCode());
|
|
|
|
if (storeWdCategoryCount == null){
|
|
if (storeWdCategoryCount == null){
|
|
- StoreWdCategoryCountBody storeWdCategoryCountBody = new StoreWdCategoryCountBody();
|
|
|
|
- if(initManageType.getSubCategory() != null && !initManageType.getSubCategory().equals("")){
|
|
|
|
- storeWdCategoryCountBody.setName(initManageType.getSubCategory());
|
|
|
|
- }else if(initManageType.getMidCategory() != null && !initManageType.getMidCategory().equals("")){
|
|
|
|
- storeWdCategoryCountBody.setName(initManageType.getMidCategory());
|
|
|
|
- }else if (initManageType.getBigCategory() != null && !initManageType.getBigCategory().equals("")){
|
|
|
|
- storeWdCategoryCountBody.setName(initManageType.getBigCategory());
|
|
|
|
- }
|
|
|
|
- storeWdCategoryCountBody.setManageTypeCode(wdInfo.getManageTypeCode());
|
|
|
|
- storeWdCategoryCountBody.setCount(wdInfo.getCommentCount());
|
|
|
|
|
|
+ //创建 门店网点分类数量体
|
|
|
|
+ StoreWdCategoryCountBody storeWdCategoryCountBody = createStoreWdCategoryCountBody(manageType);
|
|
|
|
+ storeWdCategoryCountBody.setManageTypeCode(storeWd.getManageTypeCode()); //分类code
|
|
|
|
+ storeWdCategoryCountBody.setCount(storeWd.getCommentCount()); //数量
|
|
|
|
|
|
|
|
+ //初始化 门店网点分类数量对象
|
|
StoreWdCategoryCount storeWdCategoryCount1 = new StoreWdCategoryCount();
|
|
StoreWdCategoryCount storeWdCategoryCount1 = new StoreWdCategoryCount();
|
|
storeWdCategoryCount1.setManageTypeCode(s);
|
|
storeWdCategoryCount1.setManageTypeCode(s);
|
|
storeWdCategoryCount1.setName(initMapUtil.getInitManageType(s).getMidCategory());
|
|
storeWdCategoryCount1.setName(initMapUtil.getInitManageType(s).getMidCategory());
|
|
- storeWdCategoryCount1.setCount(wdInfo.getCommentCount());
|
|
|
|
|
|
+ storeWdCategoryCount1.setCount(storeWd.getCommentCount());
|
|
|
|
+
|
|
|
|
+ //将 门店网点分类数量体 封装进 门店网点数量对象
|
|
ArrayList<StoreWdCategoryCountBody> list = new ArrayList<>();
|
|
ArrayList<StoreWdCategoryCountBody> list = new ArrayList<>();
|
|
list.add(storeWdCategoryCountBody);
|
|
list.add(storeWdCategoryCountBody);
|
|
storeWdCategoryCount1.setStoreWdCategoryCountBodyList(list);
|
|
storeWdCategoryCount1.setStoreWdCategoryCountBodyList(list);
|
|
hashMap.put(s,storeWdCategoryCount1);
|
|
hashMap.put(s,storeWdCategoryCount1);
|
|
}else {
|
|
}else {
|
|
- StoreWdCategoryCountBody storeWdCategoryCountBody = new StoreWdCategoryCountBody();
|
|
|
|
- if(initManageType.getSubCategory() != null && !initManageType.getSubCategory().equals("")){
|
|
|
|
- storeWdCategoryCountBody.setName(initManageType.getSubCategory());
|
|
|
|
- }else if(initManageType.getMidCategory() != null && !initManageType.getMidCategory().equals("")){
|
|
|
|
- storeWdCategoryCountBody.setName(initManageType.getMidCategory());
|
|
|
|
- }else if (initManageType.getBigCategory() != null && !initManageType.getBigCategory().equals("")){
|
|
|
|
- storeWdCategoryCountBody.setName(initManageType.getBigCategory());
|
|
|
|
- }
|
|
|
|
- storeWdCategoryCountBody.setManageTypeCode(wdInfo.getManageTypeCode());
|
|
|
|
- storeWdCategoryCountBody.setCount(wdInfo.getCommentCount());
|
|
|
|
|
|
+ //创建 门店网点分类数量体
|
|
|
|
+ StoreWdCategoryCountBody storeWdCategoryCountBody = createStoreWdCategoryCountBody(manageType);
|
|
|
|
+ storeWdCategoryCountBody.setManageTypeCode(storeWd.getManageTypeCode());
|
|
|
|
+ storeWdCategoryCountBody.setCount(storeWd.getCommentCount());
|
|
|
|
|
|
|
|
+ //将 门店网点分类数量体 封装进 门店网点数量对象
|
|
storeWdCategoryCount.getStoreWdCategoryCountBodyList().add(storeWdCategoryCountBody);
|
|
storeWdCategoryCount.getStoreWdCategoryCountBodyList().add(storeWdCategoryCountBody);
|
|
storeWdCategoryCount.setCount(storeWdCategoryCountBody.getCount()+storeWdCategoryCount.getCount());
|
|
storeWdCategoryCount.setCount(storeWdCategoryCountBody.getCount()+storeWdCategoryCount.getCount());
|
|
//hashMap.put(s,storeWdCategoryCount);
|
|
//hashMap.put(s,storeWdCategoryCount);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- //6.组装结果集
|
|
|
|
|
|
+ //3.组装结果集
|
|
List<StoreWdCategoryCount> storeWdCategoryCounts = new ArrayList<>();
|
|
List<StoreWdCategoryCount> storeWdCategoryCounts = new ArrayList<>();
|
|
for (String s : hashMap.keySet()) {
|
|
for (String s : hashMap.keySet()) {
|
|
storeWdCategoryCounts.add(hashMap.get(s));
|
|
storeWdCategoryCounts.add(hashMap.get(s));
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
return storeWdCategoryCounts;
|
|
return storeWdCategoryCounts;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 创建门店网点分类体
|
|
|
|
+ * @param manageType 具体的分类实体
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public StoreWdCategoryCountBody createStoreWdCategoryCountBody(ManageType manageType){
|
|
|
|
+ StoreWdCategoryCountBody storeWdCategoryCountBody = new StoreWdCategoryCountBody();
|
|
|
|
+ if(manageType.getSubCategory() != null && !manageType.getSubCategory().equals("")){
|
|
|
|
+ storeWdCategoryCountBody.setName(manageType.getSubCategory());
|
|
|
|
+ }else if(manageType.getMidCategory() != null && !manageType.getMidCategory().equals("")){
|
|
|
|
+ storeWdCategoryCountBody.setName(manageType.getMidCategory());
|
|
|
|
+ }else if (manageType.getBigCategory() != null && !manageType.getBigCategory().equals("")){
|
|
|
|
+ storeWdCategoryCountBody.setName(manageType.getBigCategory());
|
|
|
|
+ }
|
|
|
|
+ return storeWdCategoryCountBody;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 网点营业状态统计
|
|
|
|
+ * @param channelMapAceeptVo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public HashMap businessStatusAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
public HashMap businessStatusAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
|
|
+ //1.查询所有符合的门店网点
|
|
|
|
+ channelMapAceeptVo.setChannel(new String[]{"1"});
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.select("wd_id");
|
|
queryWrapper.select("wd_id");
|
|
- assembleQueryWrapper(queryWrapper,channelMapAceeptVo);
|
|
|
|
- queryWrapper.and(queryWrapper1 -> {
|
|
|
|
- queryWrapper1.eq("wd_type_code","1");
|
|
|
|
- });
|
|
|
|
- queryWrapper.and(queryWrapper2 ->{
|
|
|
|
- queryWrapper2.eq("show_delete",0);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
|
|
+ assembleQueryWrapper(queryWrapper,channelMapAceeptVo); //封装过滤条件
|
|
List<StoreWd> storeWds = storeWdDao.businessStatusAnalyse(queryWrapper);
|
|
List<StoreWd> storeWds = storeWdDao.businessStatusAnalyse(queryWrapper);
|
|
- HashMap<String,Integer> hashMap = new HashMap<>();
|
|
|
|
|
|
+
|
|
|
|
+ //2.统计 HashMap<营业状态,直方图统计体>
|
|
|
|
+ ArrayList<Histogram> list = new ArrayList<>();
|
|
int total = 0;
|
|
int total = 0;
|
|
for (StoreWd storeWd : storeWds) {
|
|
for (StoreWd storeWd : storeWds) {
|
|
total+=storeWd.getCommentCount();
|
|
total+=storeWd.getCommentCount();
|
|
- hashMap.put(storeWd.getBusinessStatus(),storeWd.getCommentCount());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ArrayList<Histogram> list = new ArrayList<>();
|
|
|
|
- for (String s : hashMap.keySet()) {
|
|
|
|
Histogram histogram = new Histogram();
|
|
Histogram histogram = new Histogram();
|
|
- histogram.setName(s);
|
|
|
|
- histogram.setCount(hashMap.get(s));
|
|
|
|
|
|
+ histogram.setName(storeWd.getBusinessStatus());
|
|
|
|
+ histogram.setCount(storeWd.getCommentCount());
|
|
list.add(histogram);
|
|
list.add(histogram);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //3.返回结果集
|
|
HashMap<String, Object> result = new HashMap<>();
|
|
HashMap<String, Object> result = new HashMap<>();
|
|
result.put("total",total);
|
|
result.put("total",total);
|
|
result.put("data",list);
|
|
result.put("data",list);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 楼宇类别统计
|
|
|
|
+ * @param channelMapAceeptVo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public ArrayList<Histogram> aroundBuildAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
public ArrayList<Histogram> aroundBuildAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
|
|
+ //1.查询所有符合的网点
|
|
|
|
+ channelMapAceeptVo.setChannel(new String[]{"3"});
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.select("type_code_by","count(*) as audit");
|
|
queryWrapper.select("type_code_by","count(*) as audit");
|
|
- assembleQueryWrapper(queryWrapper,channelMapAceeptVo);
|
|
|
|
- queryWrapper.and(queryWrapper1 -> {
|
|
|
|
- queryWrapper1.eq("wd_type_code","3");
|
|
|
|
- });
|
|
|
|
|
|
+ assembleQueryWrapper(queryWrapper,channelMapAceeptVo); //封装过滤条件
|
|
queryWrapper.and(queryWrapper1 -> {
|
|
queryWrapper.and(queryWrapper1 -> {
|
|
queryWrapper1.isNotNull("type_code_by");
|
|
queryWrapper1.isNotNull("type_code_by");
|
|
});
|
|
});
|
|
queryWrapper.groupBy("type_code_by");
|
|
queryWrapper.groupBy("type_code_by");
|
|
List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
|
|
List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
|
|
|
|
+
|
|
|
|
+ //2.统计楼宇类别数量
|
|
int total = 0;
|
|
int total = 0;
|
|
HashMap<String,Integer> hashMap = new HashMap<>();
|
|
HashMap<String,Integer> hashMap = new HashMap<>();
|
|
for (WdInfo wdInfo : wdInfos) {
|
|
for (WdInfo wdInfo : wdInfos) {
|
|
@@ -464,10 +378,12 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
}
|
|
}
|
|
total+=wdInfo.getAudit();
|
|
total+=wdInfo.getAudit();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //3.分装统计结果
|
|
ArrayList<Histogram> list = new ArrayList<>();
|
|
ArrayList<Histogram> list = new ArrayList<>();
|
|
for (String s : hashMap.keySet()) {
|
|
for (String s : hashMap.keySet()) {
|
|
Integer integer = hashMap.get(s);
|
|
Integer integer = hashMap.get(s);
|
|
- String initTypeByMap = initMapUtil.getInitTypeByMap(s + "0000").replace(":","");
|
|
|
|
|
|
+ String initTypeByMap = initMapUtil.getInitTypeByMap(s + "0000").replace(":",""); //根据需求取大类
|
|
Histogram histogram = new Histogram();
|
|
Histogram histogram = new Histogram();
|
|
histogram.setName(initTypeByMap);
|
|
histogram.setName(initTypeByMap);
|
|
histogram.setCount(integer);
|
|
histogram.setCount(integer);
|
|
@@ -477,25 +393,29 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取人均消费直方图
|
|
|
|
+ * @param channelMapAceeptVo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public ArrayList<Histogram> perCapitaConsumpAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
public ArrayList<Histogram> perCapitaConsumpAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
|
|
+ //1.查询所有符合的网点
|
|
|
|
+ channelMapAceeptVo.setChannel(new String[]{"1"});
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.select("wd_id");
|
|
queryWrapper.select("wd_id");
|
|
assembleQueryWrapper(queryWrapper,channelMapAceeptVo);
|
|
assembleQueryWrapper(queryWrapper,channelMapAceeptVo);
|
|
- queryWrapper.and(queryWrapper1 -> {
|
|
|
|
- queryWrapper1.eq("wd_type_code","1");
|
|
|
|
- });
|
|
|
|
- queryWrapper.and(queryWrapper2 ->{
|
|
|
|
- queryWrapper2.eq("show_delete",0);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
List<StoreWd> storeWds = storeWdDao.perCapitaConsumpAnalyse(queryWrapper);
|
|
List<StoreWd> storeWds = storeWdDao.perCapitaConsumpAnalyse(queryWrapper);
|
|
|
|
+
|
|
|
|
+ //初始化
|
|
LinkedHashMap<String, Integer> linkedHashMap = new LinkedHashMap<>();
|
|
LinkedHashMap<String, Integer> linkedHashMap = new LinkedHashMap<>();
|
|
linkedHashMap.put("0~20",0);
|
|
linkedHashMap.put("0~20",0);
|
|
linkedHashMap.put("20~50",0);
|
|
linkedHashMap.put("20~50",0);
|
|
linkedHashMap.put("50~100",0);
|
|
linkedHashMap.put("50~100",0);
|
|
linkedHashMap.put("100~200",0);
|
|
linkedHashMap.put("100~200",0);
|
|
linkedHashMap.put("200以上",0);
|
|
linkedHashMap.put("200以上",0);
|
|
|
|
+
|
|
|
|
+ //2.统计各个人均消费的数量
|
|
for (StoreWd storeWd : storeWds) {
|
|
for (StoreWd storeWd : storeWds) {
|
|
if (storeWd.getPerCapitaConsumption() != null){
|
|
if (storeWd.getPerCapitaConsumption() != null){
|
|
if (storeWd.getPerCapitaConsumption() >= 0 && storeWd.getPerCapitaConsumption()<20){
|
|
if (storeWd.getPerCapitaConsumption() >= 0 && storeWd.getPerCapitaConsumption()<20){
|
|
@@ -512,6 +432,7 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //3.分装统计结果
|
|
ArrayList<Histogram> list = new ArrayList<>();
|
|
ArrayList<Histogram> list = new ArrayList<>();
|
|
for (String s : linkedHashMap.keySet()) {
|
|
for (String s : linkedHashMap.keySet()) {
|
|
Histogram histogram1 = new Histogram(s,linkedHashMap.get(s));
|
|
Histogram histogram1 = new Histogram(s,linkedHashMap.get(s));
|
|
@@ -520,20 +441,21 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取聚道分析-店龄 / 经营时长统计
|
|
|
|
+ * @param channelMapAceeptVo
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
@Override
|
|
@Override
|
|
public ArrayList<Histogram> operateTimeAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
public ArrayList<Histogram> operateTimeAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
|
|
+ //1.查询所有符合的网点
|
|
|
|
+ channelMapAceeptVo.setChannel(new String[]{"1"});
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
queryWrapper.select("wd_id");
|
|
queryWrapper.select("wd_id");
|
|
assembleQueryWrapper(queryWrapper,channelMapAceeptVo);
|
|
assembleQueryWrapper(queryWrapper,channelMapAceeptVo);
|
|
- queryWrapper.and(queryWrapper1 -> {
|
|
|
|
- queryWrapper1.eq("wd_type_code","1");
|
|
|
|
- });
|
|
|
|
- queryWrapper.and(queryWrapper2 ->{
|
|
|
|
- queryWrapper2.eq("show_delete",0);
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
List<StoreWd> storeWds = storeWdDao.operateTimeAnalyse(queryWrapper);
|
|
List<StoreWd> storeWds = storeWdDao.operateTimeAnalyse(queryWrapper);
|
|
|
|
|
|
|
|
+ //2.统计经营时长
|
|
HashMap<Integer,Integer> hashMap = new HashMap<>();
|
|
HashMap<Integer,Integer> hashMap = new HashMap<>();
|
|
for (StoreWd storeWd : storeWds) {
|
|
for (StoreWd storeWd : storeWds) {
|
|
Integer opentime = Integer.valueOf(storeWd.getOpentime().substring(0,2));
|
|
Integer opentime = Integer.valueOf(storeWd.getOpentime().substring(0,2));
|
|
@@ -546,7 +468,7 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
hashMap.put(i,integer+1);
|
|
hashMap.put(i,integer+1);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ //3.分装统计结果
|
|
ArrayList<Histogram> list = new ArrayList<>();
|
|
ArrayList<Histogram> list = new ArrayList<>();
|
|
for (Integer s : hashMap.keySet()) {
|
|
for (Integer s : hashMap.keySet()) {
|
|
Histogram histogram = new Histogram();
|
|
Histogram histogram = new Histogram();
|
|
@@ -557,7 +479,204 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 封装网点过滤条件(v1.0)
|
|
|
|
+ * @param queryWrapper
|
|
|
|
+ * @param channelMapAceeptVo
|
|
|
|
+ */
|
|
|
|
+// public void assembleQueryWrapper(QueryWrapper<WdInfo> queryWrapper,ChannelMapAceeptVo channelMapAceeptVo){
|
|
|
|
+// //1.根据不同级别得到需要查询的 地区码
|
|
|
|
+// List<String> addrCodeList = new ArrayList<>();
|
|
|
|
+// if ("province".equals(channelMapAceeptVo.getRankType())) {
|
|
|
|
+// //省码
|
|
|
|
+// for (String s : channelMapAceeptVo.getAddrCode()) {
|
|
|
|
+// String substring = s.substring(0, 2);
|
|
|
|
+// addrCodeList.add(substring);
|
|
|
|
+// }
|
|
|
|
+// } else if ("city".equals(channelMapAceeptVo.getRankType())) {
|
|
|
|
+// //省的所有市
|
|
|
|
+// for (String s : channelMapAceeptVo.getAddrCode()) {
|
|
|
|
+// String substring = s.substring(0, 2);
|
|
|
|
+// addrCodeList.add(substring);
|
|
|
|
+// }
|
|
|
|
+// } else if ("zone".equals(channelMapAceeptVo.getRankType())) {
|
|
|
|
+// //市的所有区
|
|
|
|
+// for (String s : channelMapAceeptVo.getAddrCode()) {
|
|
|
|
+// String substring = s.substring(0, 4);
|
|
|
|
+// addrCodeList.add(substring);
|
|
|
|
+// }
|
|
|
|
+// } else if ("district".equals(channelMapAceeptVo.getRankType())){
|
|
|
|
+// //区的所有街道
|
|
|
|
+// for (String s : channelMapAceeptVo.getAddrCode()) {
|
|
|
|
+// String substring = s.substring(0, 6);
|
|
|
|
+// addrCodeList.add(substring);
|
|
|
|
+// }
|
|
|
|
+// }else {
|
|
|
|
+// //省码
|
|
|
|
+// for (String s : channelMapAceeptVo.getAddrCode()) {
|
|
|
|
+// String substring = s.substring(0, 2);
|
|
|
|
+// addrCodeList.add(substring);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// queryWrapper.in("wd_type_code", channelMapAceeptVo.getChannel()).and(originWdInfoQueryWrapper -> {
|
|
|
|
+// for (String s : addrCodeList) {
|
|
|
|
+// originWdInfoQueryWrapper.likeRight("addr_code", s).or();
|
|
|
|
+// }
|
|
|
|
+// });
|
|
|
|
+//
|
|
|
|
+// //搜索字段
|
|
|
|
+// if (channelMapAceeptVo.getSearchText() != null && !channelMapAceeptVo.getSearchText() .trim().equals("")) {
|
|
|
|
+// queryWrapper.and(originWdInfoQueryWrapper -> {
|
|
|
|
+// originWdInfoQueryWrapper.like("wd_name", channelMapAceeptVo.getSearchText() );
|
|
|
|
+// });
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// //城市等级分类
|
|
|
|
+// if(channelMapAceeptVo.getCityTier() != null && channelMapAceeptVo.getCityTier().length > 0){
|
|
|
|
+// List<String> tierCode = new ArrayList<>();
|
|
|
|
+// for (String s : channelMapAceeptVo.getCityTier()) {
|
|
|
|
+// List<String> list = initMapUtil.getInitCityTierListMap(s);
|
|
|
|
+// if (list != null){
|
|
|
|
+// tierCode.addAll(list);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// queryWrapper.and(wdInfoQueryWrapper -> {
|
|
|
|
+// for (String s : tierCode) {
|
|
|
|
+// wdInfoQueryWrapper.likeRight("addr_code", s).or();
|
|
|
|
+// }
|
|
|
|
+// });
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// //排序字段查询
|
|
|
|
+// if (channelMapAceeptVo.getOrderby() != null && !channelMapAceeptVo.getOrderby().trim().equals("")) {
|
|
|
|
+// PageHelper.orderBy(channelMapAceeptVo.getOrderby());
|
|
|
|
+// }
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 封装网点过滤条件(v2.0)
|
|
|
|
+ * @param queryWrapper
|
|
|
|
+ * @param channelMapAceeptVo
|
|
|
|
+ */
|
|
public void assembleQueryWrapper(QueryWrapper<WdInfo> queryWrapper,ChannelMapAceeptVo channelMapAceeptVo){
|
|
public void assembleQueryWrapper(QueryWrapper<WdInfo> queryWrapper,ChannelMapAceeptVo channelMapAceeptVo){
|
|
|
|
+ //1.根据不同级别得到需要查询的 地区码
|
|
|
|
+ List<String> wdAddrCode = findWdAddrCode(channelMapAceeptVo.getRankType(), channelMapAceeptVo.getAddrCode());
|
|
|
|
+
|
|
|
|
+ //店龄
|
|
|
|
+ if(channelMapAceeptVo.getStoreAge() != null && !channelMapAceeptVo.getStoreAge().equals("")){
|
|
|
|
+ queryWrapper.and(wdInfoQueryWrapper -> {
|
|
|
|
+ wdInfoQueryWrapper.eq("store_age",channelMapAceeptVo.getStoreAge());
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //地区过滤
|
|
|
|
+ queryWrapper.and(wdInfoQueryWrapper -> {
|
|
|
|
+ wdInfoQueryWrapper.in("addr_code", wdAddrCode);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //渠道过滤
|
|
|
|
+ if(channelMapAceeptVo.getChannel() != null && channelMapAceeptVo.getChannel().length != 6){
|
|
|
|
+ queryWrapper.and(wdInfoQueryWrapper -> {
|
|
|
|
+ wdInfoQueryWrapper.in("wd_type_code", channelMapAceeptVo.getChannel());
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //城市等级分类
|
|
|
|
+ if(channelMapAceeptVo.getCityTier() != null && channelMapAceeptVo.getCityTier().length > 0){
|
|
|
|
+ List<String> tierCode = new ArrayList<>();
|
|
|
|
+ for (String s : channelMapAceeptVo.getCityTier()) {
|
|
|
|
+ List<String> list = initMapUtil.getInitCityTierListMap(s);
|
|
|
|
+ if (list != null){
|
|
|
|
+ tierCode.addAll(list);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ queryWrapper.and(wdInfoQueryWrapper -> {
|
|
|
|
+ wdInfoQueryWrapper.in("addr_code",tierCode);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //是否关联品牌
|
|
|
|
+ if(channelMapAceeptVo.getIsBrand() != null && !channelMapAceeptVo.getIsBrand().equals("")){
|
|
|
|
+ queryWrapper.and(wdInfoQueryWrapper -> {
|
|
|
|
+ wdInfoQueryWrapper.isNotNull("brand_name");
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //是否有联系方式
|
|
|
|
+ if(channelMapAceeptVo.getIsTelephone() != null && !channelMapAceeptVo.getIsTelephone().equals("")){
|
|
|
|
+ queryWrapper.and(wdInfoQueryWrapper -> {
|
|
|
|
+ wdInfoQueryWrapper.isNotNull("teletphone");
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //搜索字段
|
|
|
|
+ if (channelMapAceeptVo.getSearchText() != null && !channelMapAceeptVo.getSearchText() .trim().equals("")) {
|
|
|
|
+ queryWrapper.and(originWdInfoQueryWrapper -> {
|
|
|
|
+ originWdInfoQueryWrapper.like("wd_name", channelMapAceeptVo.getSearchText() );
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //排序字段查询
|
|
|
|
+ if (channelMapAceeptVo.getOrderby() != null && !channelMapAceeptVo.getOrderby().trim().equals("")) {
|
|
|
|
+ PageHelper.orderBy(channelMapAceeptVo.getOrderby());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 找到所有满足条件的网点addrCode
|
|
|
|
+ * @param rankType
|
|
|
|
+ * @param addrCode
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private List<String> findWdAddrCode(String rankType,String[] addrCode){
|
|
|
|
+ //1.根据不同级别得到 找到所有 完整的 区码
|
|
|
|
+ List<String> addrCodeList = new ArrayList<>();
|
|
|
|
+ if ("province".equals(rankType)) {
|
|
|
|
+ //addrCode:省码
|
|
|
|
+ for (String string:addrCode)
|
|
|
|
+ addrCodeList.add(string.substring(0, 2));
|
|
|
|
+ } else if ("city".equals(rankType)) {
|
|
|
|
+ //addrCode:省码(只允许有一个)
|
|
|
|
+ String substring = addrCode[0].substring(0, 2); //根据该省码找到旗下的所有的区
|
|
|
|
+ addrCodeList.add(substring);
|
|
|
|
+ } else if ("zone".equals(rankType)) {
|
|
|
|
+ //addrCode:市码(只允许有一个)
|
|
|
|
+ String substring = addrCode[0].substring(0, 4); //根据该市码找到旗下的所有的区
|
|
|
|
+ addrCodeList.add(substring);
|
|
|
|
+ } else {
|
|
|
|
+ for (String string:addrCode)
|
|
|
|
+ addrCodeList.add(string.substring(0, 2));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //2.找到所有完整的区码
|
|
|
|
+ QueryWrapper<AddrCategory> queryWrapper1 = new QueryWrapper<>();
|
|
|
|
+ queryWrapper1.select("addr_code");
|
|
|
|
+ queryWrapper1.ne("district", "");
|
|
|
|
+ queryWrapper1.and(addrCategoryQueryWrapper -> {
|
|
|
|
+ for (String s : addrCodeList) {
|
|
|
|
+ addrCategoryQueryWrapper.likeRight("addr_code", s).or();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ List<AddrCategory> addrCategories1 = addrCategoryDao.selectList(queryWrapper1);
|
|
|
|
+ List<String> collect = addrCategories1.stream().map(item -> {
|
|
|
|
+ return item.getAddrCode();
|
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
+ return collect;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 分装筛选条件(模糊查询)
|
|
|
|
+ * @param queryWrapper
|
|
|
|
+ * @param channelMapAceeptVo
|
|
|
|
+ */
|
|
|
|
+ /* public void assembleQueryWrapper(QueryWrapper<WdInfo> queryWrapper,ChannelMapAceeptVo channelMapAceeptVo){
|
|
//1.根据不同级别得到需要查询的 地区码
|
|
//1.根据不同级别得到需要查询的 地区码
|
|
List<String> addrCodeList = new ArrayList<>();
|
|
List<String> addrCodeList = new ArrayList<>();
|
|
if ("province".equals(channelMapAceeptVo.getRankType())) {
|
|
if ("province".equals(channelMapAceeptVo.getRankType())) {
|
|
@@ -626,8 +745,6 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
PageHelper.orderBy(channelMapAceeptVo.getOrderby());
|
|
PageHelper.orderBy(channelMapAceeptVo.getOrderby());
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
}
|
|
}
|