yupeng
2025-03-05 4788c0abe7193191b3ca024b0f5f8fed196294bd
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTenantServiceImpl.java
@@ -7,11 +7,13 @@
import com.ruoyi.common.constant.DictConstants;
import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.dto.TTenantDTO;
import com.ruoyi.system.mapper.SysUserMapper;
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.TDept;
import com.ruoyi.system.model.THouse;
import com.ruoyi.system.model.TTenant;
import com.ruoyi.system.query.TBillAppletQuery;
@@ -113,14 +115,20 @@
    @Override
    public PageInfo<TBillVO> listBill(TBillAppletQuery query) {
        List<String> contractIds = contractMapper.selectList(new LambdaQueryWrapper<TContract>()
                        .eq(TContract::getTenantId, query.getId())).stream().map(TContract::getId)
        List<TContract> tContracts = contractMapper.selectList(new LambdaQueryWrapper<TContract>()
                .eq(TContract::getTenantId, query.getId()));
        List<String> contractIds = tContracts.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()));
            TContract contract = tContracts.stream().filter(e -> e.getId().equals(tBillVO.getContractId()))
                    .findFirst().orElse(null);
            if (contract!=null){
                tBillVO.setHouse(houseMapper.selectById(contract.getHouseId()));
            }
            tBillVO.setPayFeesStatus(tBillVO.getPayFeesStatus());
        }
        pageInfo.setRecords(list);
        return pageInfo;
@@ -133,4 +141,15 @@
        pageInfo.setRecords(list);
        return pageInfo;
    }
    @Override
    public boolean isExit(TTenantDTO dto) {
        if(StringUtils.isNotEmpty(dto.getId())){
            // 修改
            return this.count(Wrappers.lambdaQuery(TTenant.class).ne(TTenant::getId, dto.getId()).eq(TTenant::getPhone, dto.getPhone())) > 0;
        }else {
            // 新增
            return this.count(Wrappers.lambdaQuery(TTenant.class).eq(TTenant::getPhone, dto.getPhone())) > 0;
        }
    }
}