同一日数据统计自动扩展为当天的0点~23点59分59秒:1、账户总额趋势;2、管理端分析页账户数量/组织数量/账户资金;

This commit is contained in:
gaoqr
2026-06-11 17:32:37 +08:00
parent f183a18271
commit 2b64c778ff
9 changed files with 17 additions and 7 deletions
@@ -7,6 +7,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* 通用统计 ReqVO
@@ -19,6 +20,8 @@ public class CommonStatisticsReqVO {
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate[] createTime;
private LocalDateTime[] createTimeForQry = null;
/**
* 统计维度单位
*/
@@ -118,7 +118,7 @@ public class StatisticsChangeUtils {
Integer unit = reqVO.getUnit();
// 计算时间跨度
getTimeSpan(reqVO);
// 计算后的开始和结束时间
// 计算后的开始和结束时间
LocalDate startDate = ObjectUtil.clone(reqVO.getCreateTime()[0]);
LocalDate endDate = ObjectUtil.clone(reqVO.getCreateTime()[1]);
@@ -3,6 +3,7 @@ package com.cf.imes.module.system.service.funds.organamount;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
import com.cf.imes.framework.security.core.util.SecurityFrameworkUtils;
import com.cf.imes.module.system.controller.admin.funds.organamount.vo.ManageAmountOverviewRespVO;
import com.cf.imes.module.system.controller.admin.funds.organamount.vo.OrganAmountGroupByCreateTimeRespVO;
@@ -106,6 +107,7 @@ public class OrganAmountServiceImpl implements OrganAmountService {
List<Map<String, Object>> series = new ArrayList<>();
Map<String, Object> orgAmountSeriesItem = new HashMap<>();
reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime()));
// 查询组织收支趋势统计
Map<String, List<OrganAmountGroupByCreateTimeRespVO>> organIncomeExpenseGroupByCreateTimeRespMap = incomeExpenseDetailsMapper.selectOrganIncomeExpenseTrendGroupByCreateTime(reqVO, queryOrg ? organId : null).stream()
.sorted(Comparator.naturalOrder())
@@ -1,5 +1,6 @@
package com.cf.imes.module.system.service.funds.statistics;
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
import com.cf.imes.framework.common.util.i18n.core.util.I18nUtils;
import com.cf.imes.module.system.controller.admin.statistics.vo.OrgStatusGroupStatisticsReqVO;
import com.cf.imes.module.system.dal.dataobject.funds.statistics.FundsTradeTypeGroupStatisticsDO;
@@ -42,6 +43,7 @@ public class FundsStatisticsServiceImpl implements FundsStatisticsService {
// 所有的日期集合
List<String> dateList = getDateList(reqVO);
reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime()));
// 销售额Map
LinkedHashMap<String, List<FundsTradeTypeGroupStatisticsDO>> purchaseMap = incomeExpenseDetailsMapper.selectTotalSalesTrendGroupByCreateTime(reqVO).stream()
.sorted(Comparator.naturalOrder())
@@ -753,6 +753,7 @@ public class OrganServiceImpl implements OrganService {
// 所有的日期集合
List<String> dateList = getDateList(reqVO);
reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime()));
// 组织有效数量
Map<String, List<OrgStatisticsIsLapseRespDTO>> orderNotLapseRespMap = organMapper.selectOrgCountAddByOrderDate(reqVO).stream()
.sorted(Comparator.naturalOrder())
@@ -12,6 +12,7 @@ import com.cf.imes.framework.common.enums.UserTypeEnum;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.pojo.PageResult;
import com.cf.imes.framework.common.util.collection.CollectionUtils;
import com.cf.imes.framework.common.util.date.LocalDateTimeUtils;
import com.cf.imes.framework.common.util.i18n.core.util.I18nUtils;
import com.cf.imes.framework.common.util.json.JsonUtils;
import com.cf.imes.framework.common.util.monitor.TracerUtils;
@@ -876,6 +877,7 @@ public class AdminUserServiceImpl implements AdminUserService {
// 所有的日期集合
List<String> dateList = getDateList(reqVO);
reqVO.setCreateTimeForQry(LocalDateTimeUtils.generateTimeSection(reqVO.getCreateTime()));
// 新增数量Map
LinkedHashMap<String, List<UserStatusGroupStatisticsDO>> userAddMap = userMapper.selectUserStatusGroupStatistics(reqVO, false).stream()
.sorted(Comparator.naturalOrder())
@@ -21,7 +21,7 @@
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]}
where create_time between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]}
and deleted = false
<if test="organId != null">
and organ_id = #{organId}
@@ -34,7 +34,7 @@
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]}
where create_time between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]}
and deleted = false
GROUP BY date
</select>
@@ -43,7 +43,7 @@
select count(o.id) as orgCount
<include refid="dateFormat"/>
from system_organization o
where o.update_time between #{req.createTime[0]} and #{req.createTime[1]}
where o.update_time between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]}
and o.deleted = 1
group by date;
</select>
@@ -68,7 +68,7 @@
select count(o.id) as orgCount
<include refid="dateCreate"/>
from system_organization o
where o.create_time between #{req.createTime[0]} and #{req.createTime[1]}
where o.create_time between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]}
and o.deleted = 0
group by date;
</select>
@@ -97,10 +97,10 @@
from system_users o
where
<if test="deleted">
o.update_time between #{req.createTime[0]} and #{req.createTime[1]}
o.update_time between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]}
</if>
<if test="!deleted">
o.create_time between #{req.createTime[0]} and #{req.createTime[1]}
o.create_time between #{req.createTimeForQry[0]} and #{req.createTimeForQry[1]}
</if>
and o.deleted = #{deleted}
group by date;