| | |
| | | } |
| | | IPage<Shop> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | MPJLambdaWrapper<Shop> queryWrapper = new MPJLambdaWrapper<>(); |
| | | queryWrapper.select("ID,NAME,ADDRESS,PROVINCE_NAME,CITY_NAME,AREA_NAME,TOWN,AREA_NAME,LEGAL_PHONE " + |
| | | queryWrapper.select("ID,NAME,LINK_PHONE,ADDRESS,PROVINCE_NAME,CITY_NAME,AREA_NAME,TOWN,AREA_NAME,LEGAL_PHONE " + |
| | | " , (6371 * ACOS(COS(RADIANS("+pageWrap.getModel().getLatitude()+")) * COS(RADIANS(latitude)) * COS(RADIANS(longitude) - RADIANS("+pageWrap.getModel().getLongitude()+")) + SIN(RADIANS("+pageWrap.getModel().getLatitude()+")) * SIN(RADIANS(latitude)) ) ) as distance " ) |
| | | .eq("isdeleted",Constants.ZERO) |
| | | .isNotNull("LATITUDE") |
| | |
| | | if(distanceM.compareTo(new BigDecimal(100))<0){ |
| | | shop.setDistanceStr("<100米"); |
| | | }else{ |
| | | shop.setDistanceStr(distanceM.divide(BigDecimal.valueOf(1)).setScale(2,BigDecimal.ROUND_HALF_UP) + "m"); |
| | | shop.setDistanceStr(distanceM.divide(BigDecimal.valueOf(1)).setScale(0,BigDecimal.ROUND_HALF_UP) + "m"); |
| | | } |
| | | }else{ |
| | | shop.setDistanceStr(shop.getDistance().divide(BigDecimal.valueOf(1)).setScale(2,BigDecimal.ROUND_HALF_UP) + "km"); |
| | |
| | | Member member = memberMapper.selectById(memberId); |
| | | //如果人员没有经纬度信息,则不查询距离 |
| | | if(Objects.nonNull(member)&&Objects.nonNull(member.getLatitude())&&Objects.nonNull(member.getLongitude())){ |
| | | queryWrapper.select("ID,NAME,ADDRESS,PROVINCE_NAME,CITY_NAME,AREA_NAME,TOWN,AREA_NAME,LEGAL_PHONE " + |
| | | queryWrapper.select(" * " + |
| | | " , (6371 * ACOS(COS(RADIANS("+member.getLatitude()+")) * COS(RADIANS(latitude)) * COS(RADIANS(longitude) - RADIANS("+member.getLongitude()+")) + SIN(RADIANS("+member.getLatitude()+")) * SIN(RADIANS(latitude)) ) ) as distance " ); |
| | | } |
| | | } |
| | |
| | | } |
| | | shop.setUsersList(usersList); |
| | | //查询经营范围信息 |
| | | List<CategorySeg> categorySegList = categorySegMapper.selectList(new QueryWrapper<CategorySeg>().lambda().eq(CategorySeg::getOrgId,shop.getOrgId()).eq(CategorySeg::getIsdeleted,Constants.ZERO)); |
| | | List<CategorySeg> categorySegList = categorySegMapper.selectList(new QueryWrapper<CategorySeg>().lambda().eq(CategorySeg::getScode,shop.getScode()).eq(CategorySeg::getIsdeleted,Constants.ZERO)); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categorySegList)){ |
| | | List<UnitCodeVo> unitCodeVoList =systemDictDataBiz.getUnitList(); |
| | | List<String> seqNameList = new ArrayList<>(); |
| | |
| | | seqNameList.add(seqName); |
| | | } |
| | | } |
| | | shop.setSeqNameList(seqNameList); |
| | | Set<String> hs = new HashSet<String>(seqNameList); |
| | | shop.setSeqNameList(new ArrayList<String>(hs)); |
| | | } |
| | | return shop; |
| | | } |
| | |
| | | if(Objects.isNull(userShop)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | Boolean manageShop = true; |
| | | if(users.getRoleCodes().indexOf(StringUtils.trimToNull(systemDictDataBiz.queryByCode(Constants.ZBOM_CUSTOMIZED,Constants.USERS_MANAGE_CODE).getCode()))>=0){ |
| | | manageShop = false; |
| | | } |
| | | List<Shop> shopList = shopMapper.selectList(new QueryWrapper<Shop>() |
| | | .lambda() |
| | | .eq(Shop::getScode,userShop.getScode()) |
| | | .eq(Shop::getType,Constants.TWO) |
| | | .eq(Shop::getSecondType,Constants.THREE) |
| | | .apply(manageShop,"1=2") |
| | | ); |
| | | //查询经营范围信息 |
| | | List<CategorySeg> categorySegAllList = categorySegMapper.selectList(new QueryWrapper<CategorySeg>().lambda() |
| | |
| | | if(StringUtils.isBlank(shop.getOrgId())){ |
| | | continue; |
| | | } |
| | | List<CategorySeg> categorySegList = categorySegAllList.stream().filter(i->i.getOrgId().equals(shop.getOrgId())).collect(Collectors.toList()); |
| | | List<CategorySeg> categorySegList = categorySegAllList.stream().filter(i->i.getScode().equals(shop.getScode())).collect(Collectors.toList()); |
| | | List<UnitCodeVo> unitCodeVoList =systemDictDataBiz.getUnitList(); |
| | | List<String> seqNameList = new ArrayList<>(); |
| | | for(CategorySeg model : categorySegList){ |
| | |
| | | seqNameList.add(seqName); |
| | | } |
| | | } |
| | | shop.setSeqNameList(seqNameList); |
| | | Set<String> hs = new HashSet<String>(seqNameList); |
| | | shop.setSeqNameList(new ArrayList<String>(hs)); |
| | | } |
| | | } |
| | | return shopList; |