Commit 7acf5043 authored by 刘林's avatar 刘林

fix:(大屏) :三库查询空指针问题处理

parent 5596eda7
......@@ -20,13 +20,13 @@
<select id="getUseRegisterCount" resultType="java.util.Map">
SELECT
C.time, -- 月份
COUNT(1) AS num -- 每月的记录数
C.time,
COUNT(1) AS num
FROM
tzs_cylinder_business_statistics C
WHERE
C.supervision_org_code LIKE '50%' -- 仅过滤 '50%' 开头的监管机构代码
C.supervision_org_code LIKE '50%'
GROUP BY
C.time -- 按月份分组
C.time
</select>
</mapper>
......@@ -1487,7 +1487,6 @@
<if test="dto.superviseUnitName != null and dto.superviseUnitName != ''">
and tjcrn.receive_org_name like CONCAT('%', #{dto.superviseUnitName}, '%')
</if>
<!-- 因更名变更是将单位下所有设备都修改,未存设备id,故筛选设备种类和类别默认筛选不到数据-->
<if test="dto.equListCode != null and dto.equListCode != ''">
and 1 = 2
</if>
......@@ -2199,7 +2198,6 @@
<if test="dto.superviseUnitName != null and dto.superviseUnitName != ''">
and tjcrn.receive_org_name like CONCAT('%', #{dto.superviseUnitName}, '%')
</if>
<!-- 因更名变更是将单位下所有设备都修改,未存设备id,故筛选设备种类和类别默认筛选不到数据-->
<if test="dto.equListCode != null and dto.equListCode != ''">
and 1 = 2
</if>
......
......@@ -46,8 +46,6 @@
"ORG_BRANCH_CODE" IS NULL
AND ibjui."RECORD" is not null
AND ibjsi."RECORD" is null
--AND ibjri."EQU_CATEGORY" = '2300'
--AND "CLAIM_STATUS" = '已认领'
order by ibjui."RECORD" desc
</select>
<select id="selectRecords" resultType="java.lang.String">
......
......@@ -184,7 +184,7 @@
and
(
<choose>
<when test="regionCode != null and regionCode != ''">--按监管单位统计时,省局使用
<when test="regionCode != null and regionCode != ''">
(
<choose>
<when test="isOrgCodeExactMatch != null and isOrgCodeExactMatch != ''">
......@@ -198,7 +198,7 @@
OR
(bi.supervise_org_code = '50' AND bi.office_region LIKE CONCAT('%', #{regionCode}, '%'))
</when>
<otherwise>--按监管单位统计时,除省局外使用
<otherwise>
<choose>
<when test="isOrgCodeExactMatch != null and isOrgCodeExactMatch != ''">
bi.supervise_org_code != '50' AND bi.supervise_org_code = #{orgCode}
......
......@@ -4170,17 +4170,22 @@ public class JGDPStatisticsServiceImpl {
}
public String sumWithValidation(List<SkjsEquipCountItemDto> list) {
if (list == null || list.isEmpty()) return "0.000";
return list.stream()
.filter(Objects::nonNull)
.map(item -> {
.map(item -> this.safeBigDecimal(item.getYlgd()))
.reduce(BigDecimal.ZERO, BigDecimal::add)
.setScale(3, RoundingMode.HALF_UP)
.toPlainString();
}
private BigDecimal safeBigDecimal(String val) {
if (val == null || val.trim().isEmpty()) return BigDecimal.ZERO;
try {
return new BigDecimal(item.getYlgd());
return new BigDecimal(val.trim());
} catch (NumberFormatException e) {
log.warn("Invalid number in item {}", item);
return BigDecimal.ZERO;
}
})
.reduce(BigDecimal.ZERO, BigDecimal::add).setScale(3, RoundingMode.HALF_UP).toPlainString();
}
public List<Map<String, Object>> getSuperviseTreeByLoginUnitCode(String orgCode) {
......
......@@ -300,7 +300,7 @@
<where>
(
<choose>
<when test="cityCode != null and cityCode != ''">--按监管单位统计时,省局使用
<when test="cityCode != null and cityCode != ''">
(
<choose>
<when test="isOrgCodeExactMatch != null and isOrgCodeExactMatch != ''">
......@@ -314,7 +314,7 @@
OR
(a.supervise_org_code = '50' AND a.office_region LIKE CONCAT('%', #{cityCode}, '%'))
</when>
<otherwise>--按监管单位统计时,除省局使用
<otherwise>
<choose>
<when test="isOrgCodeExactMatch != null and isOrgCodeExactMatch != ''">
a.supervise_org_code != '50' AND a.supervise_org_code = #{orgCode}
......
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