1、资金管理相关统计函数返回null处理,字段错误处理;2、软件购买记录入参赠送时长补充;

This commit is contained in:
gaoqr
2025-11-07 11:13:25 +08:00
parent 3ff8a544b0
commit d30da60c4f
6 changed files with 20 additions and 15 deletions
@@ -37,6 +37,9 @@ public class PurchaseRecordPageReqVO extends PageParam {
@Schema(description = "购买时长")
private Integer purchaseDuration;
@Schema(description = "赠送时长")
private Integer giftDuration;
@Schema(description = "购买时间", example = "[2022-07-01 01:01:01 ,2022-07-01 01:01:01]")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@@ -47,6 +47,7 @@ public interface PurchaseRecordMapper extends BaseMapperX<PurchaseRecordDO> {
.likeIfPresent(PurchaseRecordDO::getProductName, pageReqVO.getProductName())
.likeIfPresent(PurchaseRecordDO::getId, pageReqVO.getId())
.eqIfPresent(PurchaseRecordDO::getPurchaseDuration, pageReqVO.getPurchaseDuration())
.eqIfPresent(PurchaseRecordDO::getGiftDuration, pageReqVO.getGiftDuration())
.betweenIfPresent(PurchaseRecordDO::getCreateTime, pageReqVO.getCreateTime())
.likeIfPresent(PurchaseRecordDO::getCreator, pageReqVO.getCreator())
.eqIfPresent(PurchaseRecordDO::getTotalAmount, pageReqVO.getProductPrice())
@@ -18,7 +18,7 @@
<select id="selectOrganIncomeExpenseTrendGroupByCreateTime"
resultType="com.cf.imes.module.system.controller.admin.funds.organamount.vo.OrganAmountGroupByCreateTimeRespVO">
select sum(amount) as amount
select COALESCE(sum(amount) ,0) as amount
<include refid="dateFormat"/>
from income_expense_details
where create_time between #{req.createTime[0]} and #{req.createTime[1]}
@@ -31,7 +31,7 @@
<select id="selectTotalSalesTrendGroupByCreateTime"
resultType="com.cf.imes.module.system.dal.dataobject.funds.statistics.FundsTradeTypeGroupStatisticsDO">
select sum(amount) as amount
select COALESCE(sum(amount) ,0) as amount
<include refid="dateFormat"/>
from income_expense_details
where create_time between #{req.createTime[0]} and #{req.createTime[1]}
@@ -2,8 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.cf.imes.module.system.dal.mysql.funds.invoice.InvoiceRecordsMapper">
<select id="getManageInvoiceAmountStatistics" resultType="com.cf.imes.module.system.controller.admin.funds.invoice.vo.InvoiceAmountRespVO">
select sum(case when status = '${@com.cf.imes.module.system.enums.pay.InvoiceStatusEnum@PENDINGINVOICING.code}' then invoice_amount else 0 end) as pendingInvoice,
sum(case when status = '${@com.cf.imes.module.system.enums.pay.InvoiceStatusEnum@INVOICINGSUCCESSFUL.code}' then invoice_amount else 0 end) as invoiced
select COALESCE(sum(case when status = '${@com.cf.imes.module.system.enums.pay.InvoiceStatusEnum@PENDINGINVOICING.code}' then invoice_amount else 0 end), 0) as pendingInvoice,
COALESCE(sum(case when status = '${@com.cf.imes.module.system.enums.pay.InvoiceStatusEnum@INVOICINGSUCCESSFUL.code}' then invoice_amount else 0 end), 0) as invoiced
from invoice_records
where deleted = false
</select>
</mapper>
@@ -3,7 +3,7 @@
<mapper namespace="com.cf.imes.module.system.dal.mysql.pay.PayOrderMapper">
<select id="getRechargeTotalAmount" resultType="java.math.BigDecimal">
select sum(price) from pay_order
select COALESCE(sum(price) ,0) from pay_order
where status = '${@com.cf.imes.module.system.enums.pay.PayOrderStatusEnum@SUCCESS.status}' and deleted = false
</select>
</mapper>
@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.cf.imes.module.system.dal.mysql.funds.purchase.PurchaseRecordMapper">
<select id="getInvoicingAmount" resultType="java.math.BigDecimal">
SELECT SUM(totalAmount) AS total_spent
SELECT COALESCE(SUM(total_amount) ,0) AS total_spent
FROM purchase_record
where organ_id = #{organId} and is_invocing = '${@com.cf.imes.module.system.enums.pay.InvoiceStatusEnum@INVOICABLE.code}' and deleted = false and initial != true;
</select>
@@ -10,35 +10,35 @@
<!-- 查询机构下开票金额统计:可开票、开票中、已开票-->
<select id="getOrgInvoiceAmountStatistics" resultType="com.cf.imes.module.system.controller.admin.funds.invoice.vo.InvoiceAmountRespVO">
SELECT
SUM(
COALESCE(SUM(
CASE
WHEN is_invocing = '${@com.cf.imes.module.system.enums.pay.InvoiceStatusEnum@INVOICABLE.code}'
THEN external_spent
ELSE 0
END
) AS invocable,
) ,0) AS invocable,
SUM(
COALESCE(SUM(
CASE
WHEN is_invocing = '${@com.cf.imes.module.system.enums.pay.InvoiceStatusEnum@PENDINGINVOICING.code}'
THEN external_spent
ELSE 0
END
) AS inTheInvoice,
) ,0) AS inTheInvoice,
SUM(
COALESCE(SUM(
CASE
WHEN is_invocing = '${@com.cf.imes.module.system.enums.pay.InvoiceStatusEnum@INVOICINGSUCCESSFUL.code}'
THEN external_spent
ELSE 0
END
) AS invoiced
) ,0) AS invoiced
from purchase_record
where organ_id = #{organId} and deleted = false and initial != true;
</select>
<select id="getInvoicableAmount" resultType="java.math.BigDecimal">
select sum(external_spent) from purchase_record
select COALESCE(sum(external_spent) ,0) from purchase_record
where organ_id = #{organId} and is_invocing = '${@com.cf.imes.module.system.enums.pay.InvoiceStatusEnum@INVOICABLE.code}'
and id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
@@ -50,7 +50,7 @@
<select id="getTotalSales"
resultType="com.cf.imes.module.system.controller.admin.funds.organamount.vo.TotalSalesAmountRespVO">
select
sum(total_amount) as amount
COALESCE(sum(total_amount) ,0) as amount
from purchase_record
where deleted = false and initial != true;
</select>
@@ -58,7 +58,7 @@
<select id="getTodaySales"
resultType="java.math.BigDecimal">
select
sum(total_amount) as amount
COALESCE(sum(total_amount) ,0) as amount
from purchase_record
where deleted = false and initial != true
and create_time &gt;= CURDATE()