| | |
| | | private final MallShopApplyMapper mallShopApplyMapper; |
| | | private final MallRegisterAppealMapper mallRegisterAppealMapper; |
| | | private final MallTeamLeaderMapper mallTeamLeaderMapper; |
| | | private final SpringContextHolder springContextHolder; |
| | | |
| | | |
| | | @Value("${spring.profiles.active}") |
| | |
| | | return new FebsResponse().fail().message("验证码错误"); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse xcxOpen(ApiXcxOpenDto apiXcxOpenDto) { |
| | | DataDictionaryCustom rangeSwitch = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RANGE_SWITCH.getType(), DataDictionaryEnum.RANGE_SWITCH.getCode()); |
| | | if(StrUtil.isNotBlank(rangeSwitch.getValue()) && "1".equals(rangeSwitch.getValue())){ |
| | | if(ObjectUtil.isNull(apiXcxOpenDto.getLongitude()) || ObjectUtil.isNull(apiXcxOpenDto.getLatitude())){ |
| | | return new FebsResponse().fail().message("请授权位置信息"); |
| | | } |
| | | Double longitude = apiXcxOpenDto.getLongitude(); |
| | | Double latitude = apiXcxOpenDto.getLatitude(); |
| | | |
| | | DataDictionaryCustom rangeSize = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.RANGE_SIZE.getType(), DataDictionaryEnum.RANGE_SIZE.getCode()); |
| | | if(ObjectUtil.isEmpty(rangeSize)){ |
| | | return new FebsResponse().fail().message("系统繁忙"); |
| | | } |
| | | if(StrUtil.isBlank(rangeSize.getValue())){ |
| | | return new FebsResponse().fail().message("系统繁忙"); |
| | | } |
| | | //方位大小,换成单位:米 |
| | | Integer value = Integer.parseInt(rangeSize.getValue()) * 1000; |
| | | //根据经纬度获取周围团长的距离 |
| | | MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByLonAndLat(longitude, latitude); |
| | | Double distance = mallTeamLeader.getDistance(); |
| | | if(value <= distance){ |
| | | return new FebsResponse().fail().message("系统繁忙"); |
| | | } |
| | | } |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | private String getXcxLoginUrl(String code) { |
| | | String wechatLoginUrl =xcxProperties.getWecharLoginUrl(); |
| | | return String.format(wechatLoginUrl, xcxProperties.getXcxAppid(), xcxProperties.getXcxSecret(), code); |