| | |
| | | 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.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private TbScheduleService scheduleService; |
| | | |
| | | @Autowired |
| | | private TbShareholderService shareholderService; |
| | | |
| | | @Autowired |
| | | private TbBuyerCompanyInfoService buyerCompanyInfoService; |
| | | |
| | | @Autowired |
| | | private TbUserService userService; |
| | | |
| | | @Autowired |
| | | private TbCompanyTypeService companyTypeService; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @Override |
| | | public Page<IndexCompanyListVo> getCompanyList(CompanyListQuery query, Long userId) { |
| | |
| | | } |
| | | 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()); |
| | | } |
| | | |
| | | if (query.getRegisteredCapitals() != null && query.getRegisteredCapitals().size() > 0) { |
| | | |
| | | queryWrapper.in(TbCompany::getRegisteredCapital, query.getRegisteredCapitals()); |
| | | } |
| | | |
| | |
| | | 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)); |
| | |
| | | |
| | | @Override |
| | | @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
| | | public void pushCompany(PushCompanyDto dto, Long userId) { |
| | | public String pushCompany(PushCompanyDto dto, Long userId) { |
| | | TbCompany tbCompany = new TbCompany(); |
| | | BeanUtils.copyProperties(dto, tbCompany); |
| | | tbCompany.setUserId(userId.toString()); |
| | |
| | | openingBank.setCompanyId(tbCompany.getId()); |
| | | openingBankService.save(openingBank); |
| | | } |
| | | return tbCompany.getId(); |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public HashMap<String, Object> getMyPushCompanyListNum(Long userId, HashMap<String, Object> map) { |
| | | List<MyPushCompanyListVo> list = this.baseMapper.getMyPushCompanyListNum(userId); |
| | | map.put("pendingTransaction", list.stream().filter(e -> e.getStatus() == 1).count()); |
| | | map.put("toBeConfirmed", list.stream().filter(e -> e.getStatus() == 2).count()); |
| | | map.put("confirmed", list.stream().filter(e -> e.getStatus() == 3).count()); |
| | | map.put("processing", list.stream().filter(e -> e.getStatus() == 4).count()); |
| | | map.put("completed", list.stream().filter(e -> e.getStatus() == 5).count()); |
| | | return map; |
| | | } |
| | | @Override |
| | | public CompanyDetailVo companyDetail(String companyId, Long userId) { |
| | | CompanyDetailVo companyDetailVo = new CompanyDetailVo(); |
| | | TbCompany tbCompany = this.baseMapper.selectById(companyId); |
| | | BeanUtils.copyProperties(tbCompany, companyDetailVo); |
| | | companyDetailVo.setState(tbCompany.getStatus()); |
| | | |
| | | TbIndustry industry = industryService.getById(tbCompany.getCompanyIndustryId()); |
| | | companyDetailVo.setCompanyIndustryName(industry.getName()); |
| | |
| | | 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); |
| | |
| | | } |
| | | |
| | | TbOrder order = orderService.getOne(new LambdaQueryWrapper<TbOrder>().eq(TbOrder::getCompanyId, companyId).gt(TbOrder::getStatus, 0).orderByDesc(TbOrder::getCreateTime).last("limit 1")); |
| | | companyDetailVo.setStatus(order.getStatus()); |
| | | if(order!=null){ |
| | | companyDetailVo.setStatus(order.getStatus()); |
| | | companyDetailVo.setSellerFinishTime(order.getSellerFinishTime()); |
| | | companyDetailVo.setOrderId(order.getId()); |
| | | } |
| | | |
| | | List<TbSchedule> list2 = scheduleService.list(new LambdaQueryWrapper<TbSchedule>().eq(TbSchedule::getOrderId, order.getId()).orderByDesc(TbSchedule::getCreateTime)); |
| | | List<TbSchedule> collect = list2.stream().filter(e -> StringUtils.isEmpty(e.getParentId())).collect(Collectors.toList()); |
| | |
| | | |
| | | TbBuyerCompanyInfo one = buyerCompanyInfoService.getOne(new LambdaQueryWrapper<TbBuyerCompanyInfo>().eq(TbBuyerCompanyInfo::getOrderId, order.getId())); |
| | | CustomerInfoVo customerInfoVo = new CustomerInfoVo(); |
| | | BeanUtils.copyProperties(one, customerInfoVo); |
| | | if(one!=null){ |
| | | BeanUtils.copyProperties(one, customerInfoVo); |
| | | String orderId = one.getOrderId(); |
| | | List<TbShareholder> list3 = shareholderService.list(new LambdaQueryWrapper<TbShareholder>().eq(TbShareholder::getOrderId, orderId)); |
| | | customerInfoVo.setShareHolders(list3); |
| | | } |
| | | companyDetailVo.setCustomerInfoVo(customerInfoVo); |
| | | companyDetailVo.setEstimatedRevenue(order.getPrice().subtract(order.getCommissionPrice()).subtract(order.getCommissionPlatform())); |
| | | |
| | | TbUser user = userService.getById(order.getUserId()); |
| | | companyDetailVo.setCustomerName(user.getUserName()); |
| | | |
| | | // 判断是否要迁区 是否要改名 新增天数 |
| | | if(one!=null){ |
| | | companyDetailVo.setEstimatedDays(one.getAddDay()+companyDetailVo.getEstimatedDays()); |
| | | if(one.getNeedRename()==1){ |
| | | companyDetailVo.setSaleMoney( companyDetailVo.getSaleMoney().add(companyDetailVo.getRenameMoney())); |
| | | } |
| | | if(one.getNewDistrict()==1){ |
| | | companyDetailVo.setSaleMoney( companyDetailVo.getSaleMoney().add(companyDetailVo.getRelocationAreaMoney())); |
| | | } |
| | | } |
| | | |
| | | return companyDetailVo; |
| | | } |
| | | |
| | | |
| | | } |