xiaoyong931011
2022-09-16 5501ffc9b44e7367a8d44c0c0d85d4452ca50274
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java
@@ -90,7 +90,6 @@
    }
    @Override
    public FebsResponse findLeaderListInPage(ApiLeaderListDto apiLeaderListDto) {
        //根据当前位置的经纬度查询在所属配送区域内的团长
@@ -291,6 +290,9 @@
            apiLeaderInfoVo.setTownship(mallTeamLeader.getTownship());
            apiLeaderInfoVo.setDetailAddress(mallTeamLeader.getDetailAddress());
            apiLeaderInfoVo.setAddressArea(mallTeamLeader.getAddressArea());
        }
        if(ObjectUtil.isEmpty(apiLeaderInfoVo)){
            return new FebsResponse().success();
        }
        return new FebsResponse().success().data(apiLeaderInfoVo);
    }
@@ -495,4 +497,30 @@
        return MallLeaderAchieveConversion.INSTANCE.entitysToVos(mallLeaderAchieves.getRecords());
    }
    @Override
    public FebsResponse findSomeLeaderListInPage(ApiLeaderListDto apiLeaderListDto) {
        Page<MallTeamLeader> page = new Page<>(apiLeaderListDto.getPageNum(), apiLeaderListDto.getPageSize());
        IPage<MallTeamLeader> mallTeamLeaderIPage = this.baseMapper.selectApiLeaderListInPage(page, apiLeaderListDto);
        List<ApiLeaderListVo> apiLeaderListVos = new ArrayList<>();
        DataDictionaryCustom rangeSwitchDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RANGE_SWITCH.getType(), DataDictionaryEnum.RANGE_SWITCH.getCode());
        if (ObjectUtil.isNotNull(rangeSwitchDic)) {
            int rangeSwitch = Integer.parseInt(rangeSwitchDic.getValue());
            if(1 == rangeSwitch){
                DataDictionaryCustom rangeSizeDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RANGE_SIZE.getType(), DataDictionaryEnum.RANGE_SIZE.getCode());
                double rangeSize = Double.parseDouble(rangeSizeDic.getValue())*1000;
                for(MallTeamLeader mallTeamLeader : mallTeamLeaderIPage.getRecords()){
                    Double distance = mallTeamLeader.getDistance();
                    if(distance <= rangeSize){
                        ApiLeaderListVo apiLeaderListVo = MallTeamLeaderConversion.INSTANCE.entityToApiVo(mallTeamLeader);
                        apiLeaderListVos.add(apiLeaderListVo);
                    }
                }
            }else{
                apiLeaderListVos = MallTeamLeaderConversion.INSTANCE.entitysToVos(mallTeamLeaderIPage.getRecords());
            }
        }
        return new FebsResponse().success().data(apiLeaderListVos);
    }
}