| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.dto.EditCompanyDto; |
| | | import com.ruoyi.system.dto.PushCompanyDto; |
| | |
| | | import com.ruoyi.system.query.CompanyListQuery; |
| | | import com.ruoyi.system.query.MyPushCompanyListQuery; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.CompanyDetailVo; |
| | | import com.ruoyi.system.vo.CustomerInfoVo; |
| | | import com.ruoyi.system.vo.IndexCompanyListVo; |
| | | import com.ruoyi.system.vo.MyPushCompanyListVo; |
| | | import com.ruoyi.system.vo.*; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private TbUserService userService; |
| | | |
| | | @Autowired |
| | | private TbCompanyTypeService companyTypeService; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @Override |
| | | public Page<IndexCompanyListVo> getCompanyList(CompanyListQuery query, Long userId) { |
| | | Page<TbCompany> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | |
| | | } |
| | | queryWrapper.eq(TbCompany::getCityCode, query.getCityCode()); |
| | | queryWrapper.eq(TbCompany::getAreaCode, query.getAreaCode()); |
| | | queryWrapper.like(StringUtils.isNotEmpty(query.getCompanyName()),TbCompany::getCompanyName, query.getCompanyName()); |
| | | |
| | | if (query.getCompanyCategorys() != null && query.getCompanyCategorys().size() > 0) { |
| | | queryWrapper.in(TbCompany::getCompanyCategory, query.getCompanyCategorys()); |
| | |
| | | queryWrapper.orderByDesc(TbCompany::getCreateTime); |
| | | } |
| | | Page<TbCompany> companyPage = this.baseMapper.selectPage(page, queryWrapper); |
| | | if(companyPage.getRecords().isEmpty()){ |
| | | return page1; |
| | | if (companyPage.getRecords().isEmpty()) { |
| | | return page1; |
| | | } |
| | | List<Integer> ids = companyPage.getRecords().stream().map(TbCompany::getCompanyIndustryId).collect(Collectors.toList()); |
| | | List<TbIndustry> tbIndustries = industryService.list(new LambdaQueryWrapper<TbIndustry>().in(TbIndustry::getId, ids)); |
| | |
| | | List<TbOpeningBank> list1 = openingBankService.list(new LambdaQueryWrapper<TbOpeningBank>().eq(TbOpeningBank::getCompanyId, companyId)); |
| | | companyDetailVo.setOpeningBanks(list1); |
| | | |
| | | Integer companyCategory = tbCompany.getCompanyCategory(); |
| | | TbCompanyType byId = companyTypeService.getById(companyCategory); |
| | | companyDetailVo.setCompanyCategoryName(byId.getName()); |
| | | |
| | | // 当前未产生订单 |
| | | if (tbCompany.getStatus() == 1) { |
| | | companyDetailVo.setStatus(1); |
| | |
| | | TbUser user = userService.getById(order.getUserId()); |
| | | companyDetailVo.setCustomerName(user.getUserName()); |
| | | |
| | | // 异常原因 |
| | | List<Object> cacheList = redisCache.getCacheList("abnormal_" + companyId); |
| | | if (cacheList.isEmpty()) { |
| | | ArrayList<AbnormalVo> abnormalVos = new ArrayList<>(); |
| | | for (Object o : cacheList) { |
| | | AbnormalVo abnormalVo = JSONObject.parseObject(o.toString(), AbnormalVo.class); |
| | | abnormalVos.add(abnormalVo); |
| | | } |
| | | companyDetailVo.setAbnormalVos(abnormalVos); |
| | | }else { |
| | | // TODO 企查查 次数查询加数据库 并加入缓存1天过期 |
| | | } |
| | | |
| | | return companyDetailVo; |
| | | } |
| | | } |