From 7c9f5fc33099083e0e1f5afcaad86546293bd08d Mon Sep 17 00:00:00 2001 From: liujie <1793218484@qq.com> Date: 星期一, 11 八月 2025 19:41:14 +0800 Subject: [PATCH] update --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TbCompanyServiceImpl.java | 80 ++++++++++++++++++++++++++++------------ 1 files changed, 56 insertions(+), 24 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TbCompanyServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TbCompanyServiceImpl.java index 24614d9..c9c7373 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TbCompanyServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TbCompanyServiceImpl.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.function.Consumer; import java.util.stream.Collectors; /** @@ -83,19 +84,15 @@ queryWrapper.in(TbCompany::getId, tbPermits.stream().map(TbPermit::getCompanyId).collect(Collectors.toList())); } queryWrapper.eq(TbCompany::getCityCode, query.getCityCode()); - if(query.getAreaCode()!=null && !"".equals(query.getAreaCode())){ + if (query.getAreaCode() != null && !"".equals(query.getAreaCode())) { queryWrapper.eq(TbCompany::getAreaCode, query.getAreaCode()); } - queryWrapper.like(StringUtils.isNotEmpty(query.getCompanyName()),TbCompany::getCompanyName, query.getCompanyName()); + queryWrapper.like(StringUtils.isNotEmpty(query.getCompanyName()), TbCompany::getCompanyName, query.getCompanyName()); if (query.getCompanyCategorys() != null && query.getCompanyCategorys().size() > 0) { queryWrapper.in(TbCompany::getCompanyCategory, query.getCompanyCategorys()); } - if (query.getRegisteredCapitals() != null && query.getRegisteredCapitals().size() > 0) { - - queryWrapper.in(TbCompany::getRegisteredCapital, query.getRegisteredCapitals()); - } if (query.getCompanyIndustryIds() != null && query.getCompanyIndustryIds().size() > 0) { queryWrapper.in(TbCompany::getCompanyIndustryId, query.getCompanyIndustryIds()); @@ -126,13 +123,48 @@ if (query.getHaveSoftWorks() != null) { queryWrapper.eq(TbCompany::getHaveSoftWorks, query.getHaveSoftWorks()); } - if (query.getMoneySort() != null && query.getMoneySort() == 1) { - queryWrapper.orderByDesc(TbCompany::getSaleMoney); - } else if (query.getMoneySort() != null && query.getMoneySort() == 2) { - queryWrapper.orderByAsc(TbCompany::getSaleMoney); - } else { - queryWrapper.orderByDesc(TbCompany::getCreateTime); + String sql=""; + if (query.getRegisteredCapitals() != null && query.getRegisteredCapitals().size() > 0) { + List<String> registeredCapitals = query.getRegisteredCapitals(); + sql += " and ("; + boolean first = true; + for (String registeredCapital : registeredCapitals) { + if (!first) { + sql += " OR "; + } + switch (registeredCapital) { + case "10W以下": + sql += " (registered_capital between 0 and 10)"; + break; + case "10-50W以下": + sql += " (registered_capital between 10 and 50)"; + break; + case "50-100W以下": + sql += " (registered_capital between 50 and 100)"; + break; + case "100-500W以下": + sql += " (registered_capital between 100 and 501)"; + break; + case "500-1000W以下": + sql += " (registered_capital between 500 and 1000)"; + break; + case "1000W以上": + sql += " (registered_capital >= 1000)"; + break; + } + first = false; + } + sql += ")"; } + + if (query.getMoneySort() != null && query.getMoneySort() == 1) { + sql += " ORDER BY sale_money DESC"; + } else if (query.getMoneySort() != null && query.getMoneySort() == 2) { + sql += " ORDER BY sale_money ASC"; + } else { + sql += " ORDER BY create_time DESC"; + } + queryWrapper.last(sql); Page<TbCompany> companyPage = this.baseMapper.selectPage(page, queryWrapper); if (companyPage.getRecords().isEmpty()) { return page1; @@ -153,6 +185,7 @@ indexCompanyListVo.setHighTechEnterpriseTechnology(record.getHighTechEnterpriseTechnology()); indexCompanyListVo.setPaidInFunds(record.getPaidInFunds()); indexCompanyListVo.setRegisteredCapital(record.getRegisteredCapital()); + indexCompanyListVo.setRealRegisteredCapital(record.getRealRegisteredCapital()); indexCompanyListVo.setSaleMoney(record.getSaleMoney()); if (record.getUserId().equals(userId.toString())) { indexCompanyListVo.setIsMyself(1); @@ -213,9 +246,9 @@ Page<MyPushCompanyListVo> page = new Page<>(query.getPageNum(), query.getPageSize()); Page<MyPushCompanyListVo> myPushCompanyList = this.baseMapper.getMyPushCompanyList(page, query, userId); for (MyPushCompanyListVo record : myPushCompanyList.getRecords()) { - if(record.getStatus()!=1){ + if (record.getStatus() != 1) { TbOrder order = orderService.getOne(new LambdaQueryWrapper<TbOrder>().eq(TbOrder::getCompanyId, record.getId()).ne(TbOrder::getStatus, -1).last("limit 1")); - if(order!=null){ + if (order != null) { record.setOrderId(order.getId()); } } @@ -233,6 +266,7 @@ map.put("completed", list.stream().filter(e -> e.getStatus() == 5).count() + list.stream().filter(e -> e.getStatus() == 6).count()); return map; } + @Override public CompanyDetailVo companyDetail(String companyId, Long userId) { CompanyDetailVo companyDetailVo = new CompanyDetailVo(); @@ -261,7 +295,7 @@ } TbOrder order = orderService.getOne(new LambdaQueryWrapper<TbOrder>().eq(TbOrder::getCompanyId, companyId).gt(TbOrder::getStatus, 0).orderByDesc(TbOrder::getCreateTime).last("limit 1")); - if(order!=null) { + if (order != null) { companyDetailVo.setStatus(order.getStatus()); companyDetailVo.setSellerFinishTime(order.getSellerFinishTime()); companyDetailVo.setOrderId(order.getId()); @@ -280,7 +314,7 @@ TbBuyerCompanyInfo one = buyerCompanyInfoService.getOne(new LambdaQueryWrapper<TbBuyerCompanyInfo>().eq(TbBuyerCompanyInfo::getOrderId, order.getId())); CustomerInfoVo customerInfoVo = new CustomerInfoVo(); - if(one!=null){ + if (one != null) { BeanUtils.copyProperties(one, customerInfoVo); String orderId = one.getOrderId(); List<TbShareholder> list3 = shareholderService.list(new LambdaQueryWrapper<TbShareholder>().eq(TbShareholder::getOrderId, orderId)); @@ -296,18 +330,16 @@ companyDetailVo.setSellerName(userService.getById(tbCompany.getUserId()).getUserName()); // 判断是否要迁区 是否要改名 新增天数 - if(one!=null){ - companyDetailVo.setEstimatedDays(one.getAddDay()+companyDetailVo.getEstimatedDays()); - if(one.getNeedRename()==1 && companyDetailVo.getRenameMoney()!=null){ - companyDetailVo.setSaleMoney( companyDetailVo.getSaleMoney().add(companyDetailVo.getRenameMoney())); + if (one != null) { + companyDetailVo.setEstimatedDays(one.getAddDay() + companyDetailVo.getEstimatedDays()); + if (one.getNeedRename() == 1 && companyDetailVo.getRenameMoney() != null) { + companyDetailVo.setSaleMoney(companyDetailVo.getSaleMoney().add(companyDetailVo.getRenameMoney())); } - if(one.getNewDistrict()==1 && companyDetailVo.getRelocationAreaMoney()!=null){ - companyDetailVo.setSaleMoney( companyDetailVo.getSaleMoney().add(companyDetailVo.getRelocationAreaMoney())); + if (one.getNewDistrict() == 1 && companyDetailVo.getRelocationAreaMoney() != null) { + companyDetailVo.setSaleMoney(companyDetailVo.getSaleMoney().add(companyDetailVo.getRelocationAreaMoney())); } } } - - return companyDetailVo; -- Gitblit v1.7.1