| | |
| | | import com.ruoyi.system.query.MyPushCompanyListQuery; |
| | | import com.ruoyi.system.service.*; |
| | | 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; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private TbScheduleService scheduleService; |
| | | |
| | | @Autowired |
| | | private TbShareholderService shareholderService; |
| | | |
| | | @Autowired |
| | | private TbBuyerCompanyInfoService buyerCompanyInfoService; |
| | |
| | | } |
| | | |
| | | if (query.getRegisteredCapitals() != null && query.getRegisteredCapitals().size() > 0) { |
| | | |
| | | queryWrapper.in(TbCompany::getRegisteredCapital, query.getRegisteredCapitals()); |
| | | } |
| | | |
| | |
| | | |
| | | @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()); |
| | |
| | | } |
| | | |
| | | TbOrder order = orderService.getOne(new LambdaQueryWrapper<TbOrder>().eq(TbOrder::getCompanyId, companyId).gt(TbOrder::getStatus, 0).orderByDesc(TbOrder::getCreateTime).last("limit 1")); |
| | | 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(); |
| | | 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()); |
| | | |
| | | // 异常原因 |
| | | 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); |
| | | // 判断是否要迁区 是否要改名 新增天数 |
| | | if(one!=null){ |
| | | companyDetailVo.setEstimatedDays(one.getAddDay()+companyDetailVo.getEstimatedDays()); |
| | | if(one.getNeedRename()==1){ |
| | | companyDetailVo.setSaleMoney( companyDetailVo.getSaleMoney().add(companyDetailVo.getRenameMoney())); |
| | | } |
| | | companyDetailVo.setAbnormalVos(abnormalVos); |
| | | }else { |
| | | // TODO 企查查 次数查询加数据库 并加入缓存1天过期 |
| | | if(one.getNewDistrict()==1){ |
| | | companyDetailVo.setSaleMoney( companyDetailVo.getSaleMoney().add(companyDetailVo.getRelocationAreaMoney())); |
| | | } |
| | | } |
| | | |
| | | return companyDetailVo; |
| | | } |
| | | |
| | | |
| | | } |