ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TCheckAcceptRecordController.java
@@ -7,10 +7,12 @@ import com.ruoyi.common.basic.PageInfo; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.model.TBill; import com.ruoyi.system.model.TCheckAcceptRecord; import com.ruoyi.system.model.TContract; import com.ruoyi.system.model.THouse; import com.ruoyi.system.query.TCheckAcceptRecordQuery; import com.ruoyi.system.service.TBillService; import com.ruoyi.system.service.TCheckAcceptRecordService; import com.ruoyi.system.service.TContractService; import com.ruoyi.system.service.THouseService; @@ -23,6 +25,7 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; @@ -43,6 +46,8 @@ private final TCheckAcceptRecordService checkAcceptRecordService; private final TContractService contractService; private final THouseService houseService; @Autowired private TBillService billService; @Autowired public TCheckAcceptRecordController(TCheckAcceptRecordService checkAcceptRecordService, TContractService contractService, THouseService houseService) { this.checkAcceptRecordService = checkAcceptRecordService; @@ -101,8 +106,19 @@ dto.setCode(replace.substring(2)+String.format("%03d", size+1)); // 添加验收记录 checkAcceptRecordService.save(dto); // TODO 生成结算帐单 if (dto.getCheckMoney()!=null&&(dto.getCheckMoney().compareTo(new BigDecimal("0"))!=0)){ TContract contract = contractService.getById(dto.getContractId()); // TODO 生成结算帐单 TBill tBill = new TBill(); tBill.setContractId(dto.getContractId()); tBill.setContractNumber(contract.getContractNumber()); tBill.setPayableFeesMoney(dto.getCheckMoney()); tBill.setPayableFeesTime(LocalDate.now()); tBill.setPayFeesStatus("1"); tBill.setBillType("4"); tBill.setSmsStatus(0); billService.save(tBill); } return R.ok(); } ruoyi-common/src/main/java/com/ruoyi/common/constant/DictConstants.java
@@ -40,7 +40,7 @@ */ public static final String DICT_TYPE_PAY_FEES_STATUS = "t_pay_fees_status"; /** * 账单类型 1=租金 2=押金 3=生活费用 * 账单类型 1=租金 2=押金 3=生活费用 4=房屋验收 */ public static final String DICT_TYPE_BILL_TYPE = "t_bill_type"; /** ruoyi-system/src/main/java/com/ruoyi/system/model/TBill.java
@@ -75,7 +75,7 @@ @TableField("pay_fees_type") private Integer payFeesType; @ApiModelProperty(value = "账单类型 1=租金 2=押金 3=生活费用") @ApiModelProperty(value = "账单类型 1=租金 2=押金 3=生活费用 4=房屋验收") @TableField("bill_type") private String billType; ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTenantServiceImpl.java
@@ -113,13 +113,19 @@ @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) { 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(DictUtils.getDictLabel(DictConstants.DICT_TYPE_LEASE_STATUS,tBillVO.getPayFeesStatus())); } pageInfo.setRecords(list); ruoyi-system/src/main/resources/mapper/system/TContractMapper.xml
@@ -59,6 +59,9 @@ <if test="query.status != null"> and t1.status = #{query.status} </if> <if test="query.tenantId != null"> and t1.tenant_id = #{query.tenantId} </if> AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()} </where> order by t1.create_time desc