| | |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.vo.ShopTree; |
| | | import com.doumee.dao.business.vo.ShopTreeVo; |
| | | import com.doumee.dao.business.vo.UnitCodeVo; |
| | | import com.doumee.dao.web.reqeust.EditShopDTO; |
| | | import com.doumee.dao.web.reqeust.ShopQueryByLLDTO; |
| | | import com.doumee.service.business.ShopService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.scheduling.annotation.Async; |
| | |
| | | import java.util.concurrent.Callable; |
| | | import java.util.concurrent.ExecutorService; |
| | | import java.util.concurrent.Executors; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 志邦组织信息表Service实现 |
| | |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(shopMapper.selectPage(page, queryWrapper)); |
| | | PageData<Shop> pageData = PageData.from(shopMapper.selectPage(page, queryWrapper)); |
| | | //查询经营范围信息 |
| | | 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:pageData.getRecords()) { |
| | | if(StringUtils.isBlank(shop.getOrgId())){ |
| | | continue; |
| | | } |
| | | List<CategorySeg> categorySegList = categorySegAllList.stream().filter(i->i.getOrgId().equals(shop.getOrgId())).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); |
| | | } |
| | | } |
| | | shop.setSeqNameList(seqNameList); |
| | | } |
| | | } |
| | | |
| | | return pageData; |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Async |
| | | private void dealCategoryDataBiz(List<CategoryImport> dataList, Date date, LoginUserInfo loginUserInfo) { |
| | | public void dealCategoryDataBiz(List<CategoryImport> dataList, Date date, LoginUserInfo loginUserInfo) { |
| | | try { |
| | | List<CategorySeg> categorySegList = new ArrayList<>(); |
| | | List<Segments> segmentsList = new ArrayList<>(); |
| | |
| | | |
| | | @Override |
| | | public Shop shopDetail(Long id,Long memberId) { |
| | | Member member = memberMapper.selectById(memberId); |
| | | if(Objects.isNull(member)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"未查询到用户信息"); |
| | | } |
| | | QueryWrapper<Shop> queryWrapper = new QueryWrapper<Shop>(); |
| | | //如果人员没有经纬度信息,则不查询距离 |
| | | if(Objects.nonNull(member.getLatitude())&&Objects.nonNull(member.getLongitude())){ |
| | | queryWrapper.select("ID,NAME,ADDRESS,PROVINCE_NAME,CITY_NAME,AREA_NAME,TOWN,AREA_NAME,LEGAL_PHONE," + |
| | | " CONVERT (ST_Distance_Sphere (point ("+member.getLongitude()+", "+member.getLatitude()+" ), point ( LONGITUDE, LATITUDE )) /1000,decimal(15,2)) as distance "); |
| | | if(Objects.nonNull(memberId)){ |
| | | 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," + |
| | | " CONVERT (ST_Distance_Sphere (point ("+member.getLongitude()+", "+member.getLatitude()+" ), point ( LONGITUDE, LATITUDE )) /1000,decimal(15,2)) as distance "); |
| | | } |
| | | } |
| | | queryWrapper.eq("id",id); |
| | | Shop shop = shopMapper.selectOne(queryWrapper); |
| | |
| | | } |
| | | } |
| | | shop.setUsersList(usersList); |
| | | //查询经营范围信息 |
| | | List<CategorySeg> categorySegList = categorySegMapper.selectList(new QueryWrapper<CategorySeg>().lambda().eq(CategorySeg::getOrgId,shop.getOrgId()).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<>(); |
| | | for(CategorySeg model : categorySegList){ |
| | | String seqName = systemDictDataBiz.getUnitName(model.getUnitCode(),unitCodeVoList); |
| | | if(Objects.nonNull(seqName)){ |
| | | seqNameList.add(seqName); |
| | | } |
| | | } |
| | | shop.setSeqNameList(seqNameList); |
| | | } |
| | | return shop; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updShop(EditShopDTO editShopDTO) { |
| | | if(Objects.isNull(editShopDTO) |
| | | || Objects.isNull(editShopDTO.getId())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | Shop shop = shopMapper.selectById(editShopDTO.getId()); |
| | | if(Objects.isNull(shop)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | Shop updShop = new Shop(); |
| | | BeanUtils.copyProperties(editShopDTO,updShop); |
| | | shopMapper.updateById(updShop); |
| | | } |
| | | |
| | | } |