|
@@ -13,6 +13,7 @@ import com.ruoyi.demo.entity.vo.OpcloseTimeVo;
|
|
|
import com.ruoyi.demo.mapper.*;
|
|
|
import com.ruoyi.demo.service.BrandService;
|
|
|
import com.ruoyi.demo.utils.CategoryUtil;
|
|
|
+import com.ruoyi.demo.utils.WdRedisStoreage;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -40,8 +41,6 @@ public class BrandServiceImpl implements BrandService {
|
|
|
@Autowired
|
|
|
StoreWdDao storeWdDao;
|
|
|
@Autowired
|
|
|
- WdTopologicalInfoDao wdTopologicalInfoDao;
|
|
|
- @Autowired
|
|
|
TypeByDao typeByDao;
|
|
|
@Autowired
|
|
|
WdInfoServiceImpl wdInfoService;
|
|
@@ -53,6 +52,11 @@ public class BrandServiceImpl implements BrandService {
|
|
|
BrandEvolveDao brandEvolveDao;
|
|
|
@Autowired
|
|
|
StoreWdOpcloseDao storeWdOpcloseDao;
|
|
|
+ @Autowired
|
|
|
+ WdRedisStoreage wdRedisStoreage;
|
|
|
+ @Autowired
|
|
|
+ WdInfoDao wdInfoDao;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public List<BrandSearch> searchByLikeName(String text) {
|
|
@@ -383,30 +387,52 @@ public class BrandServiceImpl implements BrandService {
|
|
|
|
|
|
// 查询门店标签
|
|
|
int count = storeWds.size(); // 总数,用于做比率
|
|
|
- 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);
|
|
|
+ QueryWrapper<WdInfo> wdInfoQueryWrapper = new QueryWrapper<>();
|
|
|
+ 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 (WdTopologicalInfo info : infos){
|
|
|
- String tag = info.getTag();
|
|
|
- String[] tags = tag.split(";");
|
|
|
- for (String t : tags){
|
|
|
- String[] split = t.split(":");
|
|
|
- if (split.length < 2)
|
|
|
+ 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);
|
|
|
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]));
|
|
|
+ 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 -> {
|
|
@@ -435,32 +461,41 @@ public class BrandServiceImpl implements BrandService {
|
|
|
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);
|
|
|
+// QueryWrapper<TypeBy> typeByQueryWrapper = new QueryWrapper<>();
|
|
|
+// typeByQueryWrapper.in("type_code_by",searchList);
|
|
|
+// List<TypeBy> typeByList = typeByDao.selectList(typeByQueryWrapper);
|
|
|
// 赋值
|
|
|
- for (TypeBy typeBy : typeByList){
|
|
|
+ for (String s : searchList){
|
|
|
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());
|
|
|
- }
|
|
|
+ bo.setName(s);
|
|
|
+ bo.setTotal(typeMap.get(s));
|
|
|
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());
|
|
|
- }
|
|
|
- });
|
|
|
+// 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());
|
|
|
+// }
|
|
|
+// });
|
|
|
return bos;
|
|
|
}
|
|
|
|