|
@@ -26,7 +26,7 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
|
|
|
|
@Autowired
|
|
|
@Qualifier("cityTierMap")
|
|
|
- HashMap<String,String> cityTierMap;
|
|
|
+ HashMap<String, String> cityTierMap;
|
|
|
|
|
|
@Autowired
|
|
|
BrandMapper brandMapper;
|
|
@@ -36,25 +36,25 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
|
|
|
|
@Autowired
|
|
|
@Qualifier("typeByMap")
|
|
|
- private HashMap<String,String> typeByMap;
|
|
|
+ private HashMap<String, String> typeByMap;
|
|
|
|
|
|
@Override
|
|
|
public HashMap cityTier(ChannelAnalyseAceeptVo channelAnalyseAceeptVo) {
|
|
|
- HashMap<String,Long> result = new HashMap<>();
|
|
|
- result.put("一线",0L);
|
|
|
- result.put("新一线",0L);
|
|
|
- result.put("二线",0L);
|
|
|
- result.put("三线",0L);
|
|
|
- result.put("四线",0L);
|
|
|
- result.put("五线",0L);
|
|
|
- result.put("其他",0L);
|
|
|
+ HashMap<String, Long> result = new HashMap<>();
|
|
|
+ result.put("一线", 0L);
|
|
|
+ result.put("新一线", 0L);
|
|
|
+ result.put("二线", 0L);
|
|
|
+ result.put("三线", 0L);
|
|
|
+ result.put("四线", 0L);
|
|
|
+ result.put("五线", 0L);
|
|
|
+ result.put("其他", 0L);
|
|
|
|
|
|
//1.获取所有符合条件的网点信息
|
|
|
QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.in("wd_type_code", channelAnalyseAceeptVo.getChannel());
|
|
|
- if(channelAnalyseAceeptVo.getSearchText() != null && !channelAnalyseAceeptVo.getSearchText().equals("")){
|
|
|
+ if (channelAnalyseAceeptVo.getSearchText() != null && !channelAnalyseAceeptVo.getSearchText().equals("")) {
|
|
|
queryWrapper.and(wdInfoQueryWrapper -> {
|
|
|
- wdInfoQueryWrapper.like("wd_name",channelAnalyseAceeptVo.getSearchText());
|
|
|
+ wdInfoQueryWrapper.like("wd_name", channelAnalyseAceeptVo.getSearchText());
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -62,15 +62,14 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
|
System.out.println(wdInfos.size());
|
|
|
for (WdInfo wdInfo : wdInfos) {
|
|
|
String addrCode = wdInfo.getAddrCode();
|
|
|
- if(cityTierMap.containsKey(addrCode)){
|
|
|
- result.put(cityTierMap.get(addrCode),result.get(cityTierMap.get(addrCode))+1);
|
|
|
- }else if(cityTierMap.containsKey(addrCode.substring(0,4))){
|
|
|
- result.put(cityTierMap.get(addrCode.substring(0,4)),result.get(cityTierMap.get(addrCode.substring(0,4)))+1);
|
|
|
- }else if(cityTierMap.containsKey(addrCode.substring(0,2))){
|
|
|
- result.put(cityTierMap.get(addrCode.substring(0,2)),result.get(cityTierMap.get(addrCode.substring(0,2)))+1);
|
|
|
- }
|
|
|
- else
|
|
|
- result.put("其他",result.get("其他")+1);
|
|
|
+ if (cityTierMap.containsKey(addrCode)) {
|
|
|
+ result.put(cityTierMap.get(addrCode), result.get(cityTierMap.get(addrCode)) + 1);
|
|
|
+ } else if (cityTierMap.containsKey(addrCode.substring(0, 4))) {
|
|
|
+ result.put(cityTierMap.get(addrCode.substring(0, 4)), result.get(cityTierMap.get(addrCode.substring(0, 4))) + 1);
|
|
|
+ } else if (cityTierMap.containsKey(addrCode.substring(0, 2))) {
|
|
|
+ result.put(cityTierMap.get(addrCode.substring(0, 2)), result.get(cityTierMap.get(addrCode.substring(0, 2))) + 1);
|
|
|
+ } else
|
|
|
+ result.put("其他", result.get("其他") + 1);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -79,17 +78,115 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<Brand> brandList(ChannelAnalyseAceeptVo channelAnalyseAceeptVo) {
|
|
|
- PageHelper.startPage(channelAnalyseAceeptVo.getPageNum(),channelAnalyseAceeptVo.getPageSize());
|
|
|
- String text = null;
|
|
|
- if(channelAnalyseAceeptVo.getSearchText() != null)
|
|
|
+ PageHelper.startPage(channelAnalyseAceeptVo.getPageNum(), channelAnalyseAceeptVo.getPageSize());
|
|
|
+ String text = "";
|
|
|
+ if (channelAnalyseAceeptVo.getSearchText() != null)
|
|
|
text = channelAnalyseAceeptVo.getSearchText();
|
|
|
List<Brand> brands = brandMapper.searchList(text);
|
|
|
PageInfo<Brand> pageInfo = new PageInfo<>(brands);
|
|
|
return pageInfo;
|
|
|
}
|
|
|
|
|
|
+ // @Override
|
|
|
+// public HashMap<String,Object> tagAnalyse(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, 4);
|
|
|
+// addrCodeList.add(substring);
|
|
|
+// }
|
|
|
+// } else if ("zone".equals(channelMapAceeptVo.getRankType())) {
|
|
|
+// //区
|
|
|
+// for (String s : channelMapAceeptVo.getAddrCode()) {
|
|
|
+// String substring = s.substring(0, 6);
|
|
|
+// addrCodeList.add(substring);
|
|
|
+// }
|
|
|
+// } else {
|
|
|
+// return null;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// //2.根据地区前缀找到所有的网点
|
|
|
+// QueryWrapper<WdTopologicalInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+// queryWrapper.in("center_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("center_wd_name", channelMapAceeptVo.getSearchText());
|
|
|
+// });
|
|
|
+// }
|
|
|
+//
|
|
|
+// queryWrapper.and(wdTopologicalInfoQueryWrapper -> {
|
|
|
+// wdTopologicalInfoQueryWrapper.eq("radius",1000); //1km内算附近
|
|
|
+// });
|
|
|
+// List<WdTopologicalInfo> originWdInfos = wdTopologicalInfoDao.selectList(queryWrapper);
|
|
|
+//
|
|
|
+// //统计
|
|
|
+// Integer total = 0 ;
|
|
|
+// HashMap<String,Integer> hashMap = new HashMap<>();
|
|
|
+// for (WdTopologicalInfo originWdInfo : originWdInfos) {
|
|
|
+// String tag = originWdInfo.getTag();
|
|
|
+// for (String s : tag.split(";")) {
|
|
|
+// String[] split = s.split(":");
|
|
|
+// if (split != null && split.length == 2) {
|
|
|
+// if(typeByMap.get(split[0]) == null)
|
|
|
+// continue;
|
|
|
+// String[] split1 = typeByMap.get(split[0]).split(":");
|
|
|
+// String t = "";
|
|
|
+// if (split1.length == 3)
|
|
|
+// t = split1[2];
|
|
|
+// else if (split1.length == 2)
|
|
|
+// t = split1[1];
|
|
|
+// else if (split1.length == 1)
|
|
|
+// t = split1[0];
|
|
|
+//
|
|
|
+// if(!t.equals("")) {
|
|
|
+// Integer integer = hashMap.get(t);
|
|
|
+// if(integer == null)
|
|
|
+// hashMap.put(t,1);
|
|
|
+// else {
|
|
|
+// hashMap.put(t,hashMap.get(t)+1);
|
|
|
+// }
|
|
|
+// total++;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// HashMap<String, Object> result = new HashMap<>();
|
|
|
+// List<TagAnalyse> list = new ArrayList<>();
|
|
|
+// for (String s : hashMap.keySet()) {
|
|
|
+// TagAnalyse tagAnalyse = new TagAnalyse();
|
|
|
+// tagAnalyse.setName(s);
|
|
|
+// tagAnalyse.setCount(hashMap.get(s));
|
|
|
+// tagAnalyse.setRadio((double)tagAnalyse.getCount()/total);
|
|
|
+// list.add(tagAnalyse);
|
|
|
+// }
|
|
|
+//
|
|
|
+// Collections.sort(list, new Comparator<TagAnalyse>() {
|
|
|
+// @Override
|
|
|
+// public int compare(TagAnalyse o1, TagAnalyse o2) {
|
|
|
+// return o2.getCount() - o1.getCount();
|
|
|
+// }
|
|
|
+// });
|
|
|
+//
|
|
|
+// result.put("total",total);
|
|
|
+// result.put("data",list);
|
|
|
+// return result;
|
|
|
+// }
|
|
|
@Override
|
|
|
- public HashMap<String,Object> tagAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
|
+ public HashMap<String, Object> tagAnalyse(ChannelMapAceeptVo channelMapAceeptVo) {
|
|
|
//1.根据不同级别得到地区码
|
|
|
List<String> addrCodeList = new ArrayList<>();
|
|
|
if ("province".equals(channelMapAceeptVo.getRankType())) {
|
|
@@ -116,8 +213,8 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
|
|
|
|
|
|
|
//2.根据地区前缀找到所有的网点
|
|
|
- QueryWrapper<WdTopologicalInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.in("center_wd_type_code", channelMapAceeptVo.getChannel()).and(originWdInfoQueryWrapper -> {
|
|
|
+ QueryWrapper<WdInfo> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.in("wd_type_code", channelMapAceeptVo.getChannel()).and(originWdInfoQueryWrapper -> {
|
|
|
for (String s : addrCodeList) {
|
|
|
originWdInfoQueryWrapper.likeRight("addr_code", s).or();
|
|
|
}
|
|
@@ -125,53 +222,46 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
|
|
|
|
if (channelMapAceeptVo.getSearchText() != null && !channelMapAceeptVo.getSearchText().trim().equals("")) {
|
|
|
queryWrapper.and(originWdInfoQueryWrapper -> {
|
|
|
- originWdInfoQueryWrapper.like("center_wd_name", channelMapAceeptVo.getSearchText());
|
|
|
+ originWdInfoQueryWrapper.like("wd_name", channelMapAceeptVo.getSearchText());
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- queryWrapper.and(wdTopologicalInfoQueryWrapper -> {
|
|
|
- wdTopologicalInfoQueryWrapper.eq("radius",1000); //1km内算附近
|
|
|
- });
|
|
|
- List<WdTopologicalInfo> originWdInfos = wdTopologicalInfoDao.selectList(queryWrapper);
|
|
|
+// queryWrapper.and(wdTopologicalInfoQueryWrapper -> {
|
|
|
+// wdTopologicalInfoQueryWrapper.eq("radius", 1000); //1km内算附近
|
|
|
+// });
|
|
|
+ List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper);
|
|
|
|
|
|
//统计
|
|
|
- Integer total = 0 ;
|
|
|
- HashMap<String,Integer> hashMap = new HashMap<>();
|
|
|
- for (WdTopologicalInfo originWdInfo : originWdInfos) {
|
|
|
- String tag = originWdInfo.getTag();
|
|
|
- for (String s : tag.split(";")) {
|
|
|
- String[] split = s.split(":");
|
|
|
- if (split != null && split.length == 2) {
|
|
|
- if(typeByMap.get(split[0]) == null)
|
|
|
- continue;
|
|
|
- String[] split1 = typeByMap.get(split[0]).split(":");
|
|
|
- String t = "";
|
|
|
- if (split1.length == 3)
|
|
|
- t = split1[2];
|
|
|
- else if (split1.length == 2)
|
|
|
- t = split1[1];
|
|
|
- else if (split1.length == 1)
|
|
|
- t = split1[0];
|
|
|
-
|
|
|
- if(!t.equals("")) {
|
|
|
- Integer integer = hashMap.get(t);
|
|
|
- if(integer == null)
|
|
|
- hashMap.put(t,1);
|
|
|
- else {
|
|
|
- hashMap.put(t,hashMap.get(t)+1);
|
|
|
- }
|
|
|
- total++;
|
|
|
- }
|
|
|
+ Integer total = 0;
|
|
|
+ HashMap<String, Integer> hashMap = new HashMap<>();
|
|
|
+ for (WdInfo wdInfo : wdInfos) {
|
|
|
+ String tag = wdInfo.getTypeNameBy();
|
|
|
+ if (tag != null && !tag.equals("")) {
|
|
|
+ Integer integer = hashMap.get(tag);
|
|
|
+ if (integer == null) {
|
|
|
+ hashMap.put(tag, 1);
|
|
|
+ } else {
|
|
|
+ hashMap.put(tag, integer + 1);
|
|
|
}
|
|
|
+ total++;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
HashMap<String, Object> result = new HashMap<>();
|
|
|
List<TagAnalyse> list = new ArrayList<>();
|
|
|
for (String s : hashMap.keySet()) {
|
|
|
TagAnalyse tagAnalyse = new TagAnalyse();
|
|
|
- tagAnalyse.setName(s);
|
|
|
+ String[] split = s.split(":");
|
|
|
+ if (split.length == 3)
|
|
|
+ tagAnalyse.setName(split[2]);
|
|
|
+ else if (split.length == 2)
|
|
|
+ tagAnalyse.setName(split[1]);
|
|
|
+ else if (split.length == 1)
|
|
|
+ tagAnalyse.setName(split[0]);
|
|
|
+ else
|
|
|
+ tagAnalyse.setName("");
|
|
|
tagAnalyse.setCount(hashMap.get(s));
|
|
|
- tagAnalyse.setRadio((double)tagAnalyse.getCount()/total);
|
|
|
+ tagAnalyse.setRadio((double) tagAnalyse.getCount() / total);
|
|
|
list.add(tagAnalyse);
|
|
|
}
|
|
|
|
|
@@ -182,8 +272,17 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- result.put("total",total);
|
|
|
- result.put("data",list);
|
|
|
+ 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);
|
|
|
+ result.put("total",list.size());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -228,5 +327,7 @@ public class ChannelAnalyseServiceImpl implements ChannelAnalyseService {
|
|
|
originWdInfoQueryWrapper.like("wd_name", channelMapAceeptVo.getSearchText());
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|