Selaa lähdekoodia

网点数量新增情况

云殇忆 1 vuosi sitten
vanhempi
säilyke
e9765ff372

+ 32 - 13
benyun-core/src/main/java/com/benyun/core/controller/BrandController.java

@@ -2,13 +2,12 @@ package com.benyun.core.controller;
 
 import com.benyun.core.entity.bo.BrandGeoLabelBo;
 import com.benyun.core.entity.bo.BrandSearch;
-import com.benyun.core.entity.vo.BrandListQueryBody;
+import com.benyun.core.entity.vo.ListQueryBody;
 import com.benyun.core.service.BrandService;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.R;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -31,7 +30,7 @@ public class BrandController extends BaseController {
 
 //    获取品牌信息列表
     @PostMapping("/list")
-    public R list(BrandListQueryBody body){
+    public R list(ListQueryBody body){
         String userId = "1";
         return R.ok(brandService.searchListByMulti(body,userId));
     }
@@ -78,24 +77,26 @@ public class BrandController extends BaseController {
         return R.ok(brandService.searchDistributionByBrandId(brandId));
     }
 
-//    获取所有品牌网点数量
+//    品牌网点数量对比
     @GetMapping("/total")
     public R total(Integer pageSize){
         return R.ok(brandService.searchTotal(pageSize));
     }
 
 //    获取品牌均分分布
-    @GetMapping("/average")
-    public R average(String brandId){
-        return R.ok(brandService.searchAvgScoreByBrandId(brandId));
-    }
+//    已废弃
+//    @GetMapping("/average")
+//    public R average(String brandId){
+//        return R.ok(brandService.searchAvgScoreByBrandId(brandId));
+//    }
 
 //    获取各地区品牌网点数量分布情况
-    @PostMapping("/countDistribution")
-    public R categoryDis(BrandListQueryBody body){
-        List<String> addrCode = body.getAddrCode();
-        return R.ok(brandService.searchAddrDistribution(addrCode));
-    }
+//    已废弃
+//    @PostMapping("/countDistribution")
+//    public R categoryDis(ListQueryBody body){
+//        List<String> addrCode = body.getAddrCode();
+//        return R.ok(brandService.searchAddrDistribution(addrCode));
+//    }
 
 //    获取品牌地理位置标签分布
     @GetMapping("/geolabel")
@@ -103,4 +104,22 @@ public class BrandController extends BaseController {
         List<BrandGeoLabelBo> brandGeoLabelBos = brandService.searchGeoLabel(brandId);
         return R.ok(brandGeoLabelBos);
     }
+
+//    行业连锁品牌发展情况
+    @PostMapping("/develop")
+    public R develop(ListQueryBody body){
+        List<String> addrCode = body.getAddrCode();
+        List<String> typeCode = body.getTypeCode(); // 网点分类(犇云)预留
+        List<String> brandId = body.getBrandId();
+        return null;
+    }
+
+//    连锁品牌近期开关店情况
+    @GetMapping("/opclose")
+    public R opclose(ListQueryBody body){
+        List<String> industryCode = body.getIndustryCode(); // 预留
+        String startTime = body.getStartTime();
+        String endTime = body.getEndTime();
+        return null;
+    }
 }

+ 37 - 16
benyun-core/src/main/java/com/benyun/core/controller/WdInfoController.java

@@ -1,6 +1,7 @@
 package com.benyun.core.controller;
 
-import com.benyun.core.entity.vo.BrandListQueryBody;
+import com.benyun.core.entity.vo.AddStatusVo;
+import com.benyun.core.entity.vo.ListQueryBody;
 import com.benyun.core.service.WdInfoService;
 import com.ruoyi.common.core.domain.R;
 import lombok.RequiredArgsConstructor;
@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.time.LocalDateTime;
 import java.util.List;
 
 @Validated
@@ -22,25 +24,44 @@ public class WdInfoController {
     WdInfoService wdInfoService;
 
 //    获取各地区网点分类分布情况
-    @PostMapping("/categoryDistribution")
-    public R categoryDistribution(BrandListQueryBody body){
-        List<String> addrCodes = body.getAddrCode();
-        List<String> typeCodes = body.getTypeCode();
-        return R.ok(wdInfoService.searchAddrTypeDistribution(addrCodes,typeCodes));
-    }
+//    已废弃
+//    @PostMapping("/categoryDistribution")
+//    public R categoryDistribution(ListQueryBody body){
+//        List<String> addrCodes = body.getAddrCode();
+//        List<String> typeCodes = body.getTypeCode();
+//        return R.ok(wdInfoService.searchAddrTypeDistribution(addrCodes,typeCodes));
+//    }
 
 //    获取各地区网点类型分布情况
-    @PostMapping("/wdTypeDistribution")
-    public R wdTypeDistribution(BrandListQueryBody body){
-        List<String> addrCodes = body.getAddrCode();
-        List<String> typeCodes = body.getTypeCode();
-        return R.ok(wdInfoService.searchWdTypeDistribution(addrCodes,typeCodes));
-    }
+//    已废弃
+//    @PostMapping("/wdTypeDistribution")
+//    public R wdTypeDistribution(ListQueryBody body){
+//        List<String> addrCodes = body.getAddrCode();
+//        List<String> typeCodes = body.getTypeCode();
+//        return R.ok(wdInfoService.searchWdTypeDistribution(addrCodes,typeCodes));
+//    }
 
 //    获取所有网点类型网点数量(降序)
-    @GetMapping("/total")
-    public R total(){
-        return R.ok(wdInfoService.searchWdTotal());
+//    已废弃
+//    @GetMapping("/total")
+//    public R total(){
+//        return R.ok(wdInfoService.searchWdTotal());
+//    }
+
+//    网点数量新增情况
+    @PostMapping("/addStatus")
+    public R addStatus(ListQueryBody body){
+        List<String> addrCode = body.getAddrCode();
+        List<String> typeCode = body.getTypeCode(); // 网点类型
+        List<AddStatusVo> addStatusVos = wdInfoService.searchAddStatus(addrCode, typeCode);
+        return R.ok(addStatusVos);
     }
 
+//    近期各地区网点开关数量变化情况
+    @PostMapping("/opclose")
+    public R opclose(ListQueryBody body){
+        List<String> addrCode = body.getAddrCode();
+        List<String> typeCode = body.getTypeCode(); // 网点分类(犇云)预留
+        return null;
+    }
 }

+ 3 - 0
benyun-core/src/main/java/com/benyun/core/dao/WdInfoMapper.java

@@ -3,6 +3,7 @@ package com.benyun.core.dao;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.benyun.core.entity.WdInfo;
 import com.benyun.core.entity.bo.WdAddrTypeDistribution;
+import com.benyun.core.entity.vo.AddStatusVo;
 import com.benyun.core.entity.vo.WdInfoVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -16,4 +17,6 @@ public interface WdInfoMapper extends BaseMapper<WdInfo> {
     List<WdAddrTypeDistribution> searchWdTotal();
 
     List<WdInfo> list(WdInfoVo wdInfoVo);
+
+    List<AddStatusVo> searchAddStatusByMulti(@Param("times") List<String> times, @Param("addrCodes") List<String> addrCodes, @Param("wdTypeCodes") List<String> wdTypeCodes);
 }

+ 0 - 1
benyun-core/src/main/java/com/benyun/core/entity/BrandStatistics.java

@@ -13,7 +13,6 @@ import java.time.LocalDateTime;
 @Data
 @TableName("bl_brand_statistics")
 public class BrandStatistics {
-    private String statId;
     private String brandId;
     private String brandName;
     private int coverProvinceCount;

+ 11 - 0
benyun-core/src/main/java/com/benyun/core/entity/vo/AddStatusVo.java

@@ -0,0 +1,11 @@
+package com.benyun.core.entity.vo;
+
+import lombok.Data;
+
+@Data
+public class AddStatusVo {
+    private String typeCode;
+    private String typeName;
+    private Integer count;
+    private String time;
+}

+ 3 - 1
benyun-core/src/main/java/com/benyun/core/entity/vo/BrandListQueryBody.java → benyun-core/src/main/java/com/benyun/core/entity/vo/ListQueryBody.java

@@ -5,7 +5,7 @@ import lombok.Data;
 import java.util.List;
 
 @Data
-public class BrandListQueryBody {
+public class ListQueryBody {
     private String text;
     private List<String> brandId;
     private List<String> industryCode;
@@ -14,6 +14,8 @@ public class BrandListQueryBody {
     private List<String> coverCityCount;
     private List<String> addrCode;
     private String orderBy;
+    private String startTime;
+    private String endTime;
     private Integer pageNum;
     private Integer pageSize;
 }

+ 4 - 4
benyun-core/src/main/java/com/benyun/core/service/BrandService.java

@@ -1,7 +1,7 @@
 package com.benyun.core.service;
 
 import com.benyun.core.entity.bo.*;
-import com.benyun.core.entity.vo.BrandListQueryBody;
+import com.benyun.core.entity.vo.ListQueryBody;
 import com.github.pagehelper.PageInfo;
 
 import java.util.List;
@@ -15,9 +15,9 @@ public interface BrandService {
     BrandDistribution searchDistributionByBrandId(String brandId);
     List<BrandProvinceBo> searchProvinceByBrandId(String brandId);
     BrandDisCloud searchDisCloudByBrandId(String brandId);
-    PageInfo<List<BrandSearch>> searchListByMulti(BrandListQueryBody body,String userId);
+    PageInfo<List<BrandSearch>> searchListByMulti(ListQueryBody body, String userId);
     List<BrandTotal> searchTotal(Integer pageSize);
-    BStoreData searchAvgScoreByBrandId(String brandId);
-    List<BrandAddrDistribution> searchAddrDistribution(List<String> addrCodes);
+//    BStoreData searchAvgScoreByBrandId(String brandId);
+//    List<BrandAddrDistribution> searchAddrDistribution(List<String> addrCodes);
     List<BrandGeoLabelBo> searchGeoLabel(String brandId);
 }

+ 5 - 3
benyun-core/src/main/java/com/benyun/core/service/WdInfoService.java

@@ -2,6 +2,7 @@ package com.benyun.core.service;
 
 import com.benyun.core.entity.WdInfo;
 import com.benyun.core.entity.bo.WdAddrTypeDistribution;
+import com.benyun.core.entity.vo.AddStatusVo;
 import com.benyun.core.entity.vo.TypeByBody;
 import com.benyun.core.entity.vo.WdInfoVo;
 import com.github.pagehelper.PageInfo;
@@ -10,7 +11,8 @@ import java.util.HashMap;
 import java.util.List;
 
 public interface WdInfoService {
-    List<WdAddrTypeDistribution> searchAddrTypeDistribution(List<String> addrCodes, List<String> typeCodes);
-    List<WdAddrTypeDistribution> searchWdTypeDistribution(List<String> addrCodes, List<String> typeCodes);
-    List<WdAddrTypeDistribution> searchWdTotal();
+//    List<WdAddrTypeDistribution> searchAddrTypeDistribution(List<String> addrCodes, List<String> typeCodes);
+//    List<WdAddrTypeDistribution> searchWdTypeDistribution(List<String> addrCodes, List<String> typeCodes);
+//    List<WdAddrTypeDistribution> searchWdTotal();
+    List<AddStatusVo> searchAddStatus(List<String> addrCodes,List<String> typeCodes);
 }

+ 33 - 33
benyun-core/src/main/java/com/benyun/core/service/impl/BrandServiceImpl.java

@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.benyun.core.dao.*;
 import com.benyun.core.entity.*;
 import com.benyun.core.entity.bo.*;
-import com.benyun.core.entity.vo.BrandListQueryBody;
+import com.benyun.core.entity.vo.ListQueryBody;
 import com.benyun.core.service.BrandService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -244,7 +244,7 @@ public class BrandServiceImpl implements BrandService {
     }
 
     @Override
-    public PageInfo<List<BrandSearch>> searchListByMulti(BrandListQueryBody body,String userId) {
+    public PageInfo<List<BrandSearch>> searchListByMulti(ListQueryBody body, String userId) {
         PageHelper.startPage(body.getPageNum(),body.getPageSize(),true);
         String text = body.getText();
         List<String> industryCode = body.getIndustryCode();
@@ -303,38 +303,38 @@ public class BrandServiceImpl implements BrandService {
         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 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<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) {

+ 88 - 46
benyun-core/src/main/java/com/benyun/core/service/impl/WdInfoServiceImpl.java

@@ -10,6 +10,7 @@ import com.benyun.core.entity.Category;
 import com.benyun.core.entity.TypeBy;
 import com.benyun.core.entity.WdInfo;
 import com.benyun.core.entity.bo.WdAddrTypeDistribution;
+import com.benyun.core.entity.vo.AddStatusVo;
 import com.benyun.core.entity.vo.TypeByBody;
 import com.benyun.core.entity.vo.WdInfoVo;
 import com.benyun.core.service.CategoryService;
@@ -22,6 +23,8 @@ import org.springframework.stereotype.Service;
 
 import java.lang.reflect.Type;
 import java.nio.charset.StandardCharsets;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -31,7 +34,11 @@ import java.util.stream.Collectors;
 @Service
 public class WdInfoServiceImpl implements WdInfoService {
     public Map<String,String> typeMap;
+    public Map<String,List<String>> typeChildren = new HashMap<>();
+
     public Map<String,String> addrMap;
+    public Map<String,List<String>> addrChildren = new HashMap<>();
+
     public Map<String,String> wdTypeMap;
     @Autowired
     WdInfoMapper wdInfoMapper;
@@ -81,12 +88,15 @@ public class WdInfoServiceImpl implements WdInfoService {
             wdTypeMap.put("5","公司网点");
         }
     }
-    private List<String> getAllOtherAddrCode(String addrCode){
+    public List<String> getAllOtherAddrCode(String addrCode){
+        if (addrChildren.get(addrCode) != null){
+//            System.out.println("quickly");
+            return addrChildren.get(addrCode);
+        }
         List<String> addrCodes = new ArrayList<>();
-        byte[] bytes = addrCode.getBytes(StandardCharsets.UTF_8);
-        String big = String.valueOf(bytes[0]) + String.valueOf(bytes[1]);
-        String mid = String.valueOf(bytes[2]) + String.valueOf(bytes[3]);
-        String sub = String.valueOf(bytes[4]) + String.valueOf(bytes[5]);
+        String big = String.valueOf(addrCode.charAt(0))+String.valueOf(addrCode.charAt(1));
+        String mid = String.valueOf(addrCode.charAt(2))+String.valueOf(addrCode.charAt(3));
+        String sub = String.valueOf(addrCode.charAt(4))+String.valueOf(addrCode.charAt(5));
         if (sub.equals("00")){
             QueryWrapper<AddrCategory> queryWrapper = new QueryWrapper<>();
             if (mid.equals("00")){
@@ -102,18 +112,24 @@ public class WdInfoServiceImpl implements WdInfoService {
                     addrCategoryQueryWrapper.ne("district","");
                 });
             }
-            List<AddrCategory> provinces = addrCategoryDao.selectList(queryWrapper);
-            addrCodes.add(provinces.listIterator().next().getAddrCode());
+            List<AddrCategory> zones = addrCategoryDao.selectList(queryWrapper);
+            for (AddrCategory zone : zones){
+                addrCodes.add(zone.getAddrCode());
+            }
+            addrChildren.put(addrCode,addrCodes);
         }else
             addrCodes.add(addrCode);
         return addrCodes;
     }
-    private List<String> getAllOtherTypeBy(String typeCode){
+    public List<String> getAllOtherTypeBy(String typeCode){
+        if (typeChildren.get(typeCode) != null){
+//            System.out.println("quickly");
+            return typeChildren.get(typeCode);
+        }
         List<String> types = new ArrayList<>();
-        byte[] bytes = typeCode.getBytes(StandardCharsets.UTF_8);
-        String big = String.valueOf(bytes[0]) + String.valueOf(bytes[1]);
-        String mid = String.valueOf(bytes[2]) + String.valueOf(bytes[3]);
-        String sub = String.valueOf(bytes[4]) + String.valueOf(bytes[5]);
+        String big = String.valueOf(typeCode.charAt(0)) + String.valueOf(typeCode.charAt(1));
+        String mid = String.valueOf(typeCode.charAt(2)) + String.valueOf(typeCode.charAt(3));
+        String sub = String.valueOf(typeCode.charAt(4)) + String.valueOf(typeCode.charAt(5));
         if (sub.equals("00")){
             QueryWrapper<TypeBy> queryWrapper = new QueryWrapper<>();
             if (mid.equals("00")){
@@ -123,56 +139,82 @@ public class WdInfoServiceImpl implements WdInfoService {
                     addrCategoryQueryWrapper.ne("sub_category","");
                 });
             }else{
-                queryWrapper.likeRight("addr_code",big+mid).and(addrCategoryQueryWrapper -> {
+                queryWrapper.likeRight("type_code_by",big+mid).and(addrCategoryQueryWrapper -> {
                     addrCategoryQueryWrapper.ne("mid_category","");
                 }).and(addrCategoryQueryWrapper -> {
                     addrCategoryQueryWrapper.ne("sub_category","");
                 });
             }
             List<TypeBy> typeByList = byDao.selectList(queryWrapper);
-            types.add(typeByList.listIterator().next().getTypeCodeBy());
+            for (TypeBy typeBy : typeByList){
+                types.add(typeBy.getTypeCodeBy());
+            }
+            typeChildren.put(typeCode,types);
         }else
             types.add(typeCode);
         return types;
     }
 
     @Override
-    public List<WdAddrTypeDistribution> searchAddrTypeDistribution(List<String> addrCodes, List<String> typeCodes) {
-        List<String> acodes = new ArrayList<>();
-        for (String s : addrCodes){
-            List<String> allOtherAddrCode = getAllOtherAddrCode(s);
-            acodes.addAll(allOtherAddrCode);
+    public List<AddStatusVo> searchAddStatus(List<String> addrCodes, List<String> typeCodes) {
+        setWdTypeMap();
+        List<String> addrs = new ArrayList<>();
+        List<String> times = new ArrayList<>();
+        for (int i = 0; i < 12; i++){
+            times.add(LocalDateTime.now().plusMonths(-i).format(DateTimeFormatter.ofPattern("yyyy-MM")));
         }
-        List<WdAddrTypeDistribution> list = wdInfoMapper.searchAddrDisByMulti(acodes, typeCodes);
-        setTypeMap();
-        setAddrMap();
-        for (WdAddrTypeDistribution wd : list){
-            wd.setTypeName(typeMap.get(wd.getTypeCode()));
-            wd.setAddrName(addrMap.get(wd.getAddrCode()));
+        if (addrCodes != null){
+            for (String s : addrCodes){
+                List<String> allOtherAddrCode = getAllOtherAddrCode(s);
+                addrs.addAll(allOtherAddrCode);
+            }
+        }else{
+            addrs = null;
         }
-        return list;
-    }
-
-    @Override
-    public List<WdAddrTypeDistribution> searchWdTypeDistribution(List<String> addrCodes, List<String> typeCodes) {
-        List<WdAddrTypeDistribution> list = wdInfoMapper.searchWdTypeDisByMulti(addrCodes, typeCodes);
-        setAddrMap();
-        setWdTypeMap();
-        for (WdAddrTypeDistribution wd : list){
-            wd.setAddrName(addrMap.get(wd.getAddrCode()));
-            wd.setTypeName(wdTypeMap.get(wd.getTypeCode()));
+        List<AddStatusVo> addStatusVos = wdInfoMapper.searchAddStatusByMulti(times, addrs, typeCodes);
+        for (AddStatusVo vo : addStatusVos){
+            vo.setTypeName(wdTypeMap.get(vo.getTypeCode()));
         }
-        return list;
+        return addStatusVos;
     }
 
-    @Override
-    public List<WdAddrTypeDistribution> searchWdTotal() {
-        List<WdAddrTypeDistribution> list = wdInfoMapper.searchWdTotal();
-        setWdTypeMap();
-        for (WdAddrTypeDistribution wd : list){
-            wd.setTypeName(wdTypeMap.get(wd.getTypeCode()));
-        }
-        return list;
-    }
+//    @Override
+//    public List<WdAddrTypeDistribution> searchAddrTypeDistribution(List<String> addrCodes, List<String> typeCodes) {
+//        List<String> acodes = new ArrayList<>();
+//        for (String s : addrCodes){
+//            List<String> allOtherAddrCode = getAllOtherAddrCode(s);
+//            acodes.addAll(allOtherAddrCode);
+//        }
+//        List<WdAddrTypeDistribution> list = wdInfoMapper.searchAddrDisByMulti(acodes, typeCodes);
+//        setTypeMap();
+//        setAddrMap();
+//        for (WdAddrTypeDistribution wd : list){
+//            wd.setTypeName(typeMap.get(wd.getTypeCode()));
+//            wd.setAddrName(addrMap.get(wd.getAddrCode()));
+//        }
+//        return list;
+//    }
+
+//    @Override
+//    public List<WdAddrTypeDistribution> searchWdTypeDistribution(List<String> addrCodes, List<String> typeCodes) {
+//        List<WdAddrTypeDistribution> list = wdInfoMapper.searchWdTypeDisByMulti(addrCodes, typeCodes);
+//        setAddrMap();
+//        setWdTypeMap();
+//        for (WdAddrTypeDistribution wd : list){
+//            wd.setAddrName(addrMap.get(wd.getAddrCode()));
+//            wd.setTypeName(wdTypeMap.get(wd.getTypeCode()));
+//        }
+//        return list;
+//    }
+
+//    @Override
+//    public List<WdAddrTypeDistribution> searchWdTotal() {
+//        List<WdAddrTypeDistribution> list = wdInfoMapper.searchWdTotal();
+//        setWdTypeMap();
+//        for (WdAddrTypeDistribution wd : list){
+//            wd.setTypeName(wdTypeMap.get(wd.getTypeCode()));
+//        }
+//        return list;
+//    }
 
 }

+ 0 - 1
benyun-core/src/main/resources/mapper/BrandStatisticsMapper.xml

@@ -4,7 +4,6 @@
     "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.benyun.core.dao.BrandStatisticsMapper">
     <resultMap type="com.benyun.core.entity.BrandStatistics" id="BrandStatisticsResult">
-        <result property="statId" column="stat_id"/>
         <result property="brandId" column="brand_id"/>
         <result property="brandName" column="brand_name"/>
         <result property="coverProvinceCount" column="cover_province_count"/>

+ 33 - 0
benyun-core/src/main/resources/mapper/WdInfoMapper.xml

@@ -17,6 +17,11 @@
         <result property="typeCode" column="wd_type_code"/>
         <result property="count" column="count"/>
     </resultMap>
+    <resultMap type="com.benyun.core.entity.vo.AddStatusVo" id="AddStatusResult">
+        <result property="typeCode" column="wd_type_code"/>
+        <result property="count" column="count"/>
+        <result property="time" column="time"/>
+    </resultMap>
     <select id="searchAddrDisByMulti" resultMap="WdAddrDisResult">
         SELECT
             addr_code,
@@ -93,4 +98,32 @@
             </if>
         </where>
     </select>
+    <select id="searchAddStatusByMulti" resultMap="AddStatusResult">
+        SELECT
+            wd_type_code,
+            COUNT(*) count,
+	        DATE_FORMAT(collect_time, "%Y-%m") time
+        FROM
+            `ddt_wd_info`
+        <trim prefix="where" prefixOverrides="and">
+            <if test="times != null">
+                <foreach collection="times" item="time" open="and DATE_FORMAT(collect_time, '%Y-%m') IN (" separator="," close=")">
+                    #{time,jdbcType=VARCHAR}
+                </foreach>
+            </if>
+            <if test="addrCodes != null">
+                <foreach collection="addrCodes" item="addrCode" open="and addr_code IN (" separator="," close=")">
+                    #{addrCode,jdbcType=VARCHAR}
+                </foreach>
+            </if>
+            <if test="wdTypeCodes != null">
+                <foreach collection="wdTypeCodes" item="type" open="and wd_type_code IN (" separator="," close=")">
+                    #{type,jdbcType=VARCHAR}
+                </foreach>
+            </if>
+        </trim>
+        GROUP BY
+            wd_type_code,
+            time
+    </select>
 </mapper>

+ 15 - 15
benyun-core/src/test/java/com/benyun/core/service/BrandServiceImplTest.java

@@ -2,7 +2,7 @@ package com.benyun.core.service;
 
 import com.benyun.core.entity.bo.BrandAddrDistribution;
 import com.benyun.core.entity.bo.BrandSearch;
-import com.benyun.core.entity.vo.BrandListQueryBody;
+import com.benyun.core.entity.vo.ListQueryBody;
 import com.github.pagehelper.PageInfo;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -71,7 +71,7 @@ public class BrandServiceImplTest {
     @Test
     public void searchListByMultiTest(){
         String userId = "1";
-        BrandListQueryBody body = new BrandListQueryBody();
+        ListQueryBody body = new ListQueryBody();
         body.setText("益禾堂");
         List<String> industryCode = new ArrayList<>();
         industryCode.add("199");
@@ -100,18 +100,18 @@ public class BrandServiceImplTest {
         System.out.println(brandService.searchTotal(10));
     }
 
-    @Test
-    public void searchAvgScoreByBrandIdTest(){
-        String brandId1 = "5eb6d4ccee1d498997c26a140a4bef08";
-        System.out.println(brandService.searchAvgScoreByBrandId(brandId1));
-    }
+//    @Test
+//    public void searchAvgScoreByBrandIdTest(){
+//        String brandId1 = "5eb6d4ccee1d498997c26a140a4bef08";
+//        System.out.println(brandService.searchAvgScoreByBrandId(brandId1));
+//    }
 
-    @Test
-    public void searchAddrTypeDisByMultiTest(){
-        List<String> addrCodes = new ArrayList<>();
-        addrCodes.add("410105000000");
-        addrCodes.add("420111000000");
-        List<BrandAddrDistribution> list = brandService.searchAddrDistribution(addrCodes);
-        System.out.println(list);
-    }
+//    @Test
+//    public void searchAddrTypeDisByMultiTest(){
+//        List<String> addrCodes = new ArrayList<>();
+//        addrCodes.add("410105000000");
+//        addrCodes.add("420111000000");
+//        List<BrandAddrDistribution> list = brandService.searchAddrDistribution(addrCodes);
+//        System.out.println(list);
+//    }
 }

+ 53 - 24
benyun-core/src/test/java/com/benyun/core/service/WdInfoServiceImplTest.java

@@ -1,10 +1,14 @@
 package com.benyun.core.service;
 
 import com.benyun.core.entity.bo.WdAddrTypeDistribution;
+import com.benyun.core.service.impl.WdInfoServiceImpl;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.FormatStyle;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -12,33 +16,58 @@ import java.util.List;
 public class WdInfoServiceImplTest {
     @Autowired
     WdInfoService wdInfoService;
+    @Autowired
+    WdInfoServiceImpl wdImpl;
 
     @Test
-    public void searchWdAddrDistributionTest(){
-        List<String> addrCodes = new ArrayList<>();
-        addrCodes.add("450902000000");
-        addrCodes.add("451302000000");
-        List<String> typeCodes = new ArrayList<>();
-        typeCodes.add("020400");
-        typeCodes.add("020103");
-        List<WdAddrTypeDistribution> list = wdInfoService.searchAddrTypeDistribution(addrCodes, typeCodes);
-        System.out.println(list);
+    public void setWdImpl(){
+//        List<String> allOtherAddrCode = wdImpl.getAllOtherAddrCode("450000000000");
+//        for (String s : allOtherAddrCode){
+//            System.out.println(s);
+//        }
+//        allOtherAddrCode = wdImpl.getAllOtherAddrCode("450000000000");
+//        for (String s : allOtherAddrCode){
+//            System.out.println(s);
+//        }
+//        List<String> allOtherTypeBy = wdImpl.getAllOtherTypeBy("010100");
+//        for (String s : allOtherTypeBy){
+//            System.out.println(s);
+//        }
+//        allOtherTypeBy = wdImpl.getAllOtherTypeBy("010100");
+//        for (String s : allOtherTypeBy){
+//            System.out.println(s);
+//        }
+        for (int i = 0; i < 12; i++){
+            System.out.println(LocalDateTime.now().plusMonths(-i).format(DateTimeFormatter.ofPattern("yyyy-MM")));
+        }
     }
 
-    @Test
-    public void searchWdTypeDistributionTest(){
-        List<String> addrCodes = new ArrayList<>();
-        addrCodes.add("450981000000");
-        addrCodes.add("451002000000");
-        List<String> typeCodes = new ArrayList<>();
-        typeCodes.add("1");
-        typeCodes.add("0");
-        List<WdAddrTypeDistribution> list = wdInfoService.searchWdTypeDistribution(addrCodes, typeCodes);
-        System.out.println(list);
-    }
+//    @Test
+//    public void searchWdAddrDistributionTest(){
+//        List<String> addrCodes = new ArrayList<>();
+//        addrCodes.add("450902000000");
+//        addrCodes.add("451302000000");
+//        List<String> typeCodes = new ArrayList<>();
+//        typeCodes.add("020400");
+//        typeCodes.add("020103");
+//        List<WdAddrTypeDistribution> list = wdInfoService.searchAddrTypeDistribution(addrCodes, typeCodes);
+//        System.out.println(list);
+//    }
 
-    @Test
-    public void searchWdTotalTest(){
-        System.out.println(wdInfoService.searchWdTotal());
-    }
+//    @Test
+//    public void searchWdTypeDistributionTest(){
+//        List<String> addrCodes = new ArrayList<>();
+//        addrCodes.add("450981000000");
+//        addrCodes.add("451002000000");
+//        List<String> typeCodes = new ArrayList<>();
+//        typeCodes.add("1");
+//        typeCodes.add("0");
+//        List<WdAddrTypeDistribution> list = wdInfoService.searchWdTypeDistribution(addrCodes, typeCodes);
+//        System.out.println(list);
+//    }
+
+//    @Test
+//    public void searchWdTotalTest(){
+//        System.out.println(wdInfoService.searchWdTotal());
+//    }
 }