Commit 31f19a0d authored by tianbo's avatar tianbo

fix(statistics): 优化安全问题统计查询逻辑

- 添加未处理状态和删除标记过滤条件 - 调整时间范围查询方式,提升性能 - 限制查询结果数量为30条并按时间排序 - 修改组织机构代码匹配逻辑,支持数组查询 - 更新年度统计数据的时间起始计算方法 - 引入日期工具类优化时间处理逻辑
parent 79d11672
......@@ -147,8 +147,13 @@
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND DATE_FORMAT ( problem_time, '%Y-%m-%d' ) >= #{time}
is_delete = '0'
AND problem_status = '未处理'
AND governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND problem_time >= #{time}
order by
problem_time
LIMIT 30
</select>
<select id="cylinderIssueMonthList" resultType="java.util.Map">
......@@ -205,11 +210,15 @@
FROM
tzs_safety_problem_tracing
WHERE
DATE_FORMAT(problem_time,'%Y') &gt;= #{now}
AND
<foreach collection="orgCodes" item="orgCode" separator="OR" open="(" close=")">
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
</foreach>
problem_time &gt;= #{now}
<if test="orgCodes != null">
AND
governing_body_org_code LIKE any(array[
<foreach collection="orgCodes" item="orgCode" separator=",">
#{orgCode}
</foreach>
])
</if>
<if test="null != status">
AND problem_status_code = #{status}
</if>
......
package com.yeejoin.amos.boot.module.statistcs.biz.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -784,8 +785,8 @@ public class AQZSDPStatisticsServiceImpl {
orgCodeAndCompanyCodesByCompanyCodes.forEach(t -> {
orgCodeAndCompanyCodesMap.put(t.get("companyCode"), t.get("orgCode"));
});
List<Map<String, Object>> allIssueCount = statisticsMapper.issueChildrenCityCountTop(orgCodes, now, null);
List<Map<String, Object>> endIssueCount = statisticsMapper.issueChildrenCityCountTop(orgCodes, now, "1");
List<Map<String, Object>> allIssueCount = statisticsMapper.issueChildrenCityCountTop(orgCodes, DateUtil.beginOfYear(new Date()).toDateStr(), null);
List<Map<String, Object>> endIssueCount = statisticsMapper.issueChildrenCityCountTop(orgCodes, DateUtil.beginOfYear(new Date()).toDateStr(), "1");
Map<String, Object> allIssuedataMap = new HashMap<>();
Map<String, Object> endIssuedataMap = new HashMap<>();
allIssueCount.forEach(t -> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment