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

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

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