|
@@ -68,167 +68,10 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
EnterpriseWdDao enterpriseWdDao;
|
|
|
|
|
|
|
|
|
- /**
|
|
|
- * 地图模式:查看所有地区的网点数量(v1.0)
|
|
|
- * @param channelMapAceeptVo
|
|
|
- * @return
|
|
|
- */
|
|
|
-/* @Override
|
|
|
- public WdCount area(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 {
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //2.找到所有需要封装的 地区信息
|
|
|
- QueryWrapper<AddrCategory> queryWrapper = new QueryWrapper<>();
|
|
|
- if ("province".equals(channelMapAceeptVo.getRankType())) {
|
|
|
- queryWrapper.eq("city", "");
|
|
|
- } else if ("city".equals(channelMapAceeptVo.getRankType())) {
|
|
|
- queryWrapper.eq("district", "").and(addrCategoryQueryWrapper -> {
|
|
|
- addrCategoryQueryWrapper.ne("city", "");
|
|
|
- });
|
|
|
- } else if ("zone".equals(channelMapAceeptVo.getRankType())) {
|
|
|
- queryWrapper.ne("district", "");
|
|
|
- }
|
|
|
- queryWrapper.and(addrCategoryQueryWrapper -> {
|
|
|
- addrCategoryQueryWrapper.or(addrCategoryQueryWrapper1 -> {
|
|
|
- for (String s : addrCodeList) {
|
|
|
- addrCategoryQueryWrapper1.likeRight("addr_code", s).or();
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- List<AddrCategory> addrCategories = addrCategoryDao.selectList(queryWrapper);
|
|
|
-
|
|
|
-
|
|
|
- //3.组装地区信息
|
|
|
- List<WdCountBody> result = new ArrayList<>();
|
|
|
- HashMap<String,Integer> statistics = new HashMap<>(); //统计信息
|
|
|
- for (AddrCategory addrCategory : addrCategories) {
|
|
|
- WdCountBody wdCountBody = new WdCountBody();
|
|
|
-
|
|
|
- //组装
|
|
|
- wdCountBody.setLat(addrCategory.getLatGd());
|
|
|
- wdCountBody.setLng(addrCategory.getLngGd());
|
|
|
- wdCountBody.setAddrCode(addrCategory.getAddrCode());
|
|
|
- if ("province".equals(channelMapAceeptVo.getRankType())) {
|
|
|
- wdCountBody.setName(addrCategory.getProvince());
|
|
|
- statistics.put(addrCategory.getAddrCode().substring(0,2),0);
|
|
|
- } else if ("city".equals(channelMapAceeptVo.getRankType())) {
|
|
|
- wdCountBody.setName(addrCategory.getCity());
|
|
|
- statistics.put(addrCategory.getAddrCode().substring(0,4),0);
|
|
|
- } else if ("zone".equals(channelMapAceeptVo.getRankType())) {
|
|
|
- wdCountBody.setName(addrCategory.getDistrict());
|
|
|
- statistics.put(addrCategory.getAddrCode().substring(0,6),0);
|
|
|
- }
|
|
|
- result.add(wdCountBody);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //4.组装条件构造器找到网点信息网点
|
|
|
- //2.1 渠道、地区分类
|
|
|
- QueryWrapper<WdInfo> queryWrapper2 = new QueryWrapper<>();
|
|
|
- queryWrapper2.select("addr_code","count(*) as audit");
|
|
|
- queryWrapper2.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("")) {
|
|
|
- queryWrapper2.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();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- queryWrapper2.groupBy("addr_code");
|
|
|
-
|
|
|
- //5.统计
|
|
|
- int total = 0;
|
|
|
- List<WdInfo> wdInfos = wdInfoDao.selectList(queryWrapper2);
|
|
|
- for (WdInfo wdInfo : wdInfos) {
|
|
|
- if("province".equals(channelMapAceeptVo.getRankType())){
|
|
|
- statistics.put(wdInfo.getAddrCode().substring(0,2),statistics.get(wdInfo.getAddrCode().substring(0,2))+wdInfo.getAudit());
|
|
|
- } else if ("city".equals(channelMapAceeptVo.getRankType())) {
|
|
|
- statistics.put(wdInfo.getAddrCode().substring(0,4),statistics.get(wdInfo.getAddrCode().substring(0,4))+wdInfo.getAudit());
|
|
|
- } else if ("zone".equals(channelMapAceeptVo.getRankType())) {
|
|
|
- statistics.put(wdInfo.getAddrCode().substring(0,6),statistics.get(wdInfo.getAddrCode().substring(0,6))+wdInfo.getAudit());
|
|
|
- }
|
|
|
- total+=+wdInfo.getAudit();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //5.计算radio
|
|
|
- for (WdCountBody wdCountBody : result) {
|
|
|
- String code = null;
|
|
|
- if("province".equals(channelMapAceeptVo.getRankType())){
|
|
|
- code = wdCountBody.getAddrCode().substring(0,2);
|
|
|
- }else if("city".equals(channelMapAceeptVo.getRankType())){
|
|
|
- code = wdCountBody.getAddrCode().substring(0,4);
|
|
|
- }else if("zone".equals(channelMapAceeptVo.getRankType())){
|
|
|
- code = wdCountBody.getAddrCode().substring(0,6);
|
|
|
- }
|
|
|
-
|
|
|
- if(statistics.get(code) != null){
|
|
|
- wdCountBody.setCount(statistics.get(code));
|
|
|
- }else {
|
|
|
- wdCountBody.setCount(0);
|
|
|
- }
|
|
|
-
|
|
|
- if (total != 0){
|
|
|
- BigDecimal bigDecimal = new BigDecimal((float) wdCountBody.getCount() / total);
|
|
|
- float v = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
|
|
|
- wdCountBody.setRadio(v);
|
|
|
- }
|
|
|
- else
|
|
|
- wdCountBody.setRadio(0.0f);
|
|
|
- }
|
|
|
- WdCount wdCount = new WdCount();
|
|
|
- wdCount.setWdCountBodyList(result);
|
|
|
- wdCount.setTotal(total);
|
|
|
- return wdCount;
|
|
|
- }*/
|
|
|
-
|
|
|
|
|
|
/**
|
|
|
* 地图模式:查看所有地区的网点数量(v2.0)
|
|
|
- * @param channelMapAceeptVo
|
|
|
+ * @param channelMapAceeptVo 渠道地图过滤请求接收体
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -351,7 +194,7 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
|
|
|
/**
|
|
|
* 地图模式:查看省级地区的网点数量(v2.0)
|
|
|
- * @param channelMapAceeptVo
|
|
|
+ * @param channelMapAceeptVo 渠道地图过滤请求接收体
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -419,7 +262,7 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
|
|
|
/**
|
|
|
* 地图模式:查看市级地区的网点数量(v2.0)
|
|
|
- * @param channelMapAceeptVo
|
|
|
+ * @param channelMapAceeptVo 渠道地图过滤请求接收体
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -622,7 +465,7 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
|
|
|
/**
|
|
|
* 获取网点列表
|
|
|
- * @param channelMapAceeptVo
|
|
|
+ * @param channelMapAceeptVo 渠道地图过滤请求接收体
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -654,7 +497,7 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
|
|
|
/**
|
|
|
* 获取区下的具体网点信息
|
|
|
- * @param channelMapAceeptVo
|
|
|
+ * @param channelMapAceeptVo 渠道地图过滤请求接收体
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -679,7 +522,7 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
|
|
|
/**
|
|
|
* 获取网点详细信息
|
|
|
- * @param wdId
|
|
|
+ * @param wdId 网点Id
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -749,8 +592,8 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
|
|
|
/**
|
|
|
* 封装网点过滤条件(v2.0)
|
|
|
- * @param queryWrapper
|
|
|
- * @param channelMapAceeptVo
|
|
|
+ * @param queryWrapper 条件构造器
|
|
|
+ * @param channelMapAceeptVo 渠道地图过滤请求接收体
|
|
|
*/
|
|
|
public void assembleQueryWrapper(QueryWrapper<WdInfo> queryWrapper,ChannelMapAceeptVo channelMapAceeptVo){
|
|
|
//1.根据不同级别得到需要查询的 地区码
|
|
@@ -831,8 +674,8 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
|
|
|
/**
|
|
|
* 找到所有满足条件的网点addrCode
|
|
|
- * @param rankType
|
|
|
- * @param addrCode
|
|
|
+ * @param rankType 搜索等级:province、city、zone
|
|
|
+ * @param addrCode 地区Codes
|
|
|
* @return
|
|
|
*/
|
|
|
private List<String> findWdAddrCode(String rankType,String[] addrCode){
|
|
@@ -873,8 +716,8 @@ public class ChannelMapServiceImpl implements ChannelMapService {
|
|
|
|
|
|
/**
|
|
|
* 找到需要展示的中心addrCode
|
|
|
- * @param rankType
|
|
|
- * @param addrCode
|
|
|
+ * @param rankType 搜索等级:province、city、zone
|
|
|
+ * @param addrCode 地区Codes
|
|
|
* @return
|
|
|
*/
|
|
|
private List<AddrCategory> findCenterAddrCode(String rankType,String[] addrCode){
|