yupeng
2025-02-28 449e10ac595070ebe0d0e18ac61a1ebe742e44c2
feat: 新增账单统计接口
5个文件已修改
1个文件已添加
65 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TBillController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/dto/BillStatisticsDto.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBillMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/TBillService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TBillController.java
@@ -116,10 +116,16 @@
    @PostMapping("cashPay")
    public R cashPay(@RequestBody CachPayDto cachPayDto){
        tBillService.cashPay(cachPayDto);
        return null;
        return R.ok();
    }
    @ApiOperation("统计")
    @GetMapping("statistics")
    public R<BillStatisticsDto> statistics(){
        BillStatisticsDto dto = tBillService.statistics();
        return R.ok(dto);
    }
ruoyi-system/src/main/java/com/ruoyi/system/dto/BillStatisticsDto.java
New file
@@ -0,0 +1,20 @@
package com.ruoyi.system.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
@Data
public class BillStatisticsDto implements Serializable {
    @ApiModelProperty("应收租金")
    private BigDecimal rent;
    @ApiModelProperty("待缴费")
    private BigDecimal nopay;
    @ApiModelProperty("已缴费")
    private BigDecimal payed;
    @ApiModelProperty("已逾期")
    private BigDecimal overdue;
}
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TBillMapper.java
@@ -9,6 +9,7 @@
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -35,4 +36,12 @@
    List<TBillDto> invoiceList(@Param("query")TBillQuery query, @Param("pageInfo")PageInfo<TBillDto> pageInfo);
    TBillDto selectDetailByBillId(@Param("billId") String billId);
    BigDecimal statisticsAllRent();
    BigDecimal statisticsNoPay();
    BigDecimal statisticsPayed();
    BigDecimal statisticsOverdue();
}
ruoyi-system/src/main/java/com/ruoyi/system/service/TBillService.java
@@ -83,4 +83,6 @@
    TBillDto getDetailByBillId(@NotEmpty String id);
    Boolean cashPay(CachPayDto offlinePayDto);
    BillStatisticsDto statistics();
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TBillServiceImpl.java
@@ -500,5 +500,15 @@
        return true;
    }
    @Override
    public BillStatisticsDto statistics() {
        BillStatisticsDto dto = new BillStatisticsDto();
        dto.setRent(getBaseMapper().statisticsAllRent());
        dto.setNopay(getBaseMapper().statisticsNoPay());
        dto.setPayed(getBaseMapper().statisticsPayed());
        dto.setOverdue(getBaseMapper().statisticsOverdue());
        return dto;
    }
}
ruoyi-system/src/main/resources/mapper/system/TBillMapper.xml
@@ -146,4 +146,20 @@
        LEFT JOIN t_tenant t ON t.id = c.tenant_id and t.disabled=0
        where b.id = #{billId}
    </select>
    <select id="statisticsAllRent" resultType="java.math.BigDecimal">
        SELECT sum(payable_fees_money) as amount FROM t_bill
    </select>
    <select id="statisticsNoPay" resultType="java.math.BigDecimal">
        SELECT sum(outstanding_money) as amount FROM t_bill where pay_fees_status!=3
    </select>
    <select id="statisticsPayed" resultType="java.math.BigDecimal">
        SELECT sum(pay_fees_money) as amount FROM t_bill
    </select>
    <select id="statisticsOverdue" resultType="java.math.BigDecimal">
        SELECT sum(outstanding_money) as amount FROM t_bill where pay_fees_status=4
    </select>
</mapper>