| | |
| | | shop.setLegalPhone(model.getLegalPhone()); |
| | | shop.setLegalIdcode(model.getLegalIdcode()); |
| | | shop.setLegalName(model.getLegalName()); |
| | | shop.setFcode(model.getFcode()); |
| | | shop.setScode(model.getScode()); |
| | | shop.setTaxRegCode(model.getTaxRegCode()); |
| | | shopMapper.updateById(shop); |
| | | } |
| | |
| | | shop.setSecondType(model.getSecondType()); |
| | | shop.setAttribute(model.getAttribute()); |
| | | shop.setParentIamId(model.getParentOrgId()); |
| | | shop.setScode(model.getScode()); |
| | | newList.add(shop); |
| | | }else { |
| | | shop.setEditor(loginUserInfo.getId()); |
| | |
| | | shop.setSecondType(model.getSecondType()); |
| | | shop.setName(model.getName()); |
| | | shop.setCode(model.getCode()); |
| | | shop.setScode(model.getScode()); |
| | | shop.setUnitCode(model.getUnitCode()); |
| | | if(Constants.equalsInteger(model.getStatus(),Constants.TWO)){ |
| | | shop.setIsdeleted(Constants.ONE); |
| | |
| | | } |
| | | 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; |
| | | } |
| | |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public List<Shop> getUserShopList(Long userId) { |
| | | Users users = usersMapper.selectById(userId); |
| | | if(Objects.isNull(users)){ |
| | | return new ArrayList<>(); |
| | | } |
| | | Shop userShop = shopMapper.selectById(users.getDepartmentId()); |
| | | 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() |
| | | .isNotNull(CategorySeg::getOrgId) |
| | | .eq(CategorySeg::getIsdeleted,Constants.ZERO)); |
| | | if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(categorySegAllList)){ |
| | | for (Shop shop:shopList) { |
| | | if(StringUtils.isBlank(shop.getOrgId())){ |
| | | continue; |
| | | } |
| | | 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){ |
| | | String seqName = systemDictDataBiz.getUnitName(model.getUnitCode(),unitCodeVoList); |
| | | if(Objects.nonNull(seqName)){ |
| | | seqNameList.add(seqName); |
| | | } |
| | | } |
| | | Set<String> hs = new HashSet<String>(seqNameList); |
| | | shop.setSeqNameList(new ArrayList<String>(hs)); |
| | | } |
| | | } |
| | | return shopList; |
| | | } |
| | | |
| | | } |