| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.DictConstants; |
| | | import com.ruoyi.common.utils.DictUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.mapper.TContractMapper; |
| | | import com.ruoyi.system.mapper.THouseMapper; |
| | | import com.ruoyi.system.mapper.TTenantMapper; |
| | | import com.ruoyi.system.model.TContract; |
| | | import com.ruoyi.system.model.THouse; |
| | | import com.ruoyi.system.model.TTenant; |
| | | import com.ruoyi.system.query.TBillAppletQuery; |
| | | import com.ruoyi.system.query.TTenantAppletQuery; |
| | | import com.ruoyi.system.query.TTenantQuery; |
| | | import com.ruoyi.system.service.TTenantService; |
| | | import com.ruoyi.system.utils.wx.pojo.AppletUserDecodeData; |
| | | import com.ruoyi.system.vo.TBillVO; |
| | | import com.ruoyi.system.vo.TenantVO; |
| | | import com.sun.corba.se.spi.ior.IdentifiableFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TTenantServiceImpl extends ServiceImpl<TTenantMapper, TTenant> implements TTenantService { |
| | | |
| | | @Autowired |
| | | private THouseMapper houseMapper; |
| | | @Autowired |
| | | private TContractMapper contractMapper; |
| | | @Override |
| | | public PageInfo<TenantVO> pageList(TTenantQuery query) { |
| | | PageInfo<TenantVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TenantVO> pageListApplet(TTenantAppletQuery query) { |
| | | PageInfo<TenantVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TenantVO> list = this.baseMapper.pageListApplet(query,pageInfo); |
| | | for (TenantVO tenantVO : list) { |
| | | tenantVO.setTenantAttributesName(StringUtils.isNotBlank(tenantVO.getTenantAttributes())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_ATTRIBUTE,tenantVO.getTenantAttributes()):""); |
| | | tenantVO.setTenantTypeName(StringUtils.isNotBlank(tenantVO.getTenantType())?DictUtils.getDictLabel(DictConstants.DICT_TYPE_TENANT_TYPE,tenantVO.getTenantType()):""); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public List<THouse> listHouse(String id) { |
| | | List<TContract> tContracts = contractMapper.selectList(new LambdaQueryWrapper<TContract>() |
| | | .eq(TContract::getTenantId,id) |
| | | .eq(TContract::getStatus, 4)); |
| | | List<String> houseIds = tContracts.stream().map(TContract::getHouseId).collect(Collectors.toList()); |
| | | if (houseIds.isEmpty())houseIds.add("-1"); |
| | | return houseMapper.selectList(new LambdaQueryWrapper<THouse>() |
| | | .in(THouse::getId, houseIds)); |
| | | } |
| | | |
| | | @Override |
| | | public List<TContract> listContract(String id) { |
| | | return contractMapper.selectList(new LambdaQueryWrapper<TContract>() |
| | | .eq(TContract::getTenantId,id) |
| | | .eq(TContract::getStatus, 4)); |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TBillVO> listBill(TBillAppletQuery query) { |
| | | List<String> contractIds = contractMapper.selectList(new LambdaQueryWrapper<TContract>() |
| | | .eq(TContract::getTenantId, query.getId())).stream().map(TContract::getId) |
| | | .collect(Collectors.toList()); |
| | | if (contractIds.isEmpty())contractIds.add("0"); |
| | | PageInfo<TBillVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TBillVO> list = this.baseMapper.listBill(query,pageInfo); |
| | | for (TBillVO tBillVO : list) { |
| | | tBillVO.setPayFeesStatus(DictUtils.getDictLabel(DictConstants.DICT_TYPE_LEASE_STATUS,tBillVO.getPayFeesStatus())); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |