1.定时任务重试代码提交

2.pmsbug修改
This commit is contained in:
wr
2024-01-09 15:57:55 +08:00
parent 7f7d7cf058
commit ab1abd8259
27 changed files with 211 additions and 204 deletions

View File

@@ -20,123 +20,45 @@
FROM
(
SELECT
b.Monitor_Sort,
b.Created_Date
FROM
(
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_client
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
) UNION ALL
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_generation_user
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
) UNION ALL
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_distributionarea
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
) UNION ALL
( SELECT id, Operation_Id, Powerr_Id, Line_Id FROM pms_monitor
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
)
) t
INNER JOIN pms_distribution_monitor b ON t.id = b.Monitor_Id
)t
GROUP BY t.Monitor_Sort,yy,mm
SELECT
b.Monitor_Sort,
b.Created_Date
FROM
pms_distribution_monitor b
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
)t
GROUP BY t.Monitor_Sort,yy,mm
) ta
-- 同比:上年同月
LEFT JOIN (
SELECT
t.Monitor_Sort,
year(t.Created_Date) as yy,
month(t.Created_Date) as mm,
COUNT(*) as num
FROM (
SELECT
b.Monitor_Sort,
b.Created_Date
SELECT
t.Monitor_Sort,
year(t.Created_Date) as yy,
month(t.Created_Date) as mm,
COUNT(*) as num
FROM
(
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_client
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
) UNION ALL
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_generation_user
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
) UNION ALL
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_distributionarea
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
) UNION ALL
( SELECT id, Operation_Id, Powerr_Id, Line_Id FROM pms_monitor
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
)
) t
INNER JOIN pms_distribution_monitor b ON t.id = b.Monitor_Id
SELECT
b.Monitor_Sort,
b.Created_Date
FROM
pms_distribution_monitor b
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
)t
GROUP BY t.Monitor_Sort,yy,mm
) tb
GROUP BY t.Monitor_Sort,yy,mm
) tb
ON tb.mm = ta.mm and tb.yy = ta.yy-1 and tb.Monitor_Sort = ta.Monitor_Sort
-- 环比:上月
@@ -146,66 +68,26 @@
year(t.Created_Date) as yy,
month(t.Created_Date) as mm,
COUNT(*) as num
FROM (
SELECT
b.Monitor_Sort,
b.Created_Date
FROM
(
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_client
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
) UNION ALL
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_generation_user
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
) UNION ALL
( SELECT id, Operation_Id, Power_Station_Id, Line_Id FROM pms_power_distributionarea
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
) UNION ALL
( SELECT id, Operation_Id, Powerr_Id, Line_Id FROM pms_monitor
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
)
) t
INNER JOIN pms_distribution_monitor b ON t.id = b.Monitor_Id
)t
GROUP BY t.Monitor_Sort,yy,mm
) tc
ON ( (tc.yy = ta.yy and tc.mm = ta.mm - 1 and tc.Monitor_Sort = ta.Monitor_Sort)
OR
(tc.yy=ta.yy - 1 AND tc.mm = 12 AND ta.mm = 1 and tc.Monitor_Sort = ta.Monitor_Sort)
)
SELECT
b.Monitor_Sort,
b.Created_Date
FROM
pms_distribution_monitor b
<where>
org_id IN
<foreach collection="orgIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
AND STATUS = 1
</where>
)t
GROUP BY t.Monitor_Sort,yy,mm
) tc
ON ( (tc.yy = ta.yy and tc.mm = ta.mm - 1 and tc.Monitor_Sort = ta.Monitor_Sort)
OR
(tc.yy=ta.yy - 1 AND tc.mm = 12 AND ta.mm = 1 and tc.Monitor_Sort = ta.Monitor_Sort)
)
<where>
<if test="param.year != null and param.year!=''">

View File

@@ -1,6 +1,7 @@
package com.njcn.device.pms.service.majornetwork.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.NumberUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.common.pojo.dto.SimpleDTO;
@@ -113,15 +114,15 @@ public class RMpDevEvaluateDetailServiceImpl extends ServiceImpl<RMpDevEvaluateD
//终端有效接入率
double devEffectiveRate = list.stream().filter(item -> terminalMap.get(item.getDeviceId()).getOrgId().equals(key))
.mapToDouble(RMpDevEvaluateDetail::getDevEffectiveRate).average().orElse(0);
rMpDevEvaluateDetailVO.setDevEffectiveRate(devEffectiveRate);
rMpDevEvaluateDetailVO.setDevEffectiveRate(NumberUtil.round(devEffectiveRate,2).doubleValue());
//终端指标完整率
double devTargetRate = list.stream().filter(item -> terminalMap.get(item.getDeviceId()).getOrgId().equals(key))
.mapToDouble(RMpDevEvaluateDetail::getDevTargetRate).average().orElse(0);
rMpDevEvaluateDetailVO.setDevTargetRate(devTargetRate);
rMpDevEvaluateDetailVO.setDevTargetRate(NumberUtil.round(devTargetRate,2).doubleValue());
//终端数据完整率
double devDataRate = list.stream().filter(item -> terminalMap.get(item.getDeviceId()).getOrgId().equals(key))
.mapToDouble(RMpDevEvaluateDetail::getDevDataRate).average().orElse(0);
rMpDevEvaluateDetailVO.setDevDataRate(devDataRate);
rMpDevEvaluateDetailVO.setDevDataRate(NumberUtil.round(devDataRate,2).doubleValue());
//综合评价
rMpDevEvaluateDetailVO.setAssessment(Double.parseDouble(df.format((devEffectiveRate + devTargetRate + devDataRate) / 3.0)));
@@ -187,15 +188,15 @@ public class RMpDevEvaluateDetailServiceImpl extends ServiceImpl<RMpDevEvaluateD
//终端有效接入率
double devEffectiveRate = list.stream().filter(item -> terminalMap.get(item.getDeviceId()).getManufacture().equals(key))
.mapToDouble(RMpDevEvaluateDetail::getDevEffectiveRate).average().orElse(0);
rMpDevEvaluateDetailVO.setDevEffectiveRate(devEffectiveRate);
rMpDevEvaluateDetailVO.setDevEffectiveRate(NumberUtil.round(devEffectiveRate,2).doubleValue());
//终端指标完整率
double devTargetRate = list.stream().filter(item -> terminalMap.get(item.getDeviceId()).getManufacture().equals(key))
.mapToDouble(RMpDevEvaluateDetail::getDevTargetRate).average().orElse(0);
rMpDevEvaluateDetailVO.setDevTargetRate(devTargetRate);
rMpDevEvaluateDetailVO.setDevTargetRate(NumberUtil.round(devTargetRate,2).doubleValue());
//终端数据完整率
double devDataRate = list.stream().filter(item -> terminalMap.get(item.getDeviceId()).getManufacture().equals(key))
.mapToDouble(RMpDevEvaluateDetail::getDevDataRate).average().orElse(0);
rMpDevEvaluateDetailVO.setDevDataRate(devDataRate);
rMpDevEvaluateDetailVO.setDevDataRate(NumberUtil.round(devDataRate,2).doubleValue());
//综合评价
rMpDevEvaluateDetailVO.setAssessment(Double.parseDouble(df.format((devEffectiveRate + devTargetRate + devDataRate) / 3.0)));
@@ -256,15 +257,15 @@ public class RMpDevEvaluateDetailServiceImpl extends ServiceImpl<RMpDevEvaluateD
//终端有效接入率
double devEffectiveRate = list.stream().filter(item -> terminalMap.get(item.getDeviceId()).getDeviceModel().equals(key))
.mapToDouble(RMpDevEvaluateDetail::getDevEffectiveRate).average().orElse(0);
rMpDevEvaluateDetailVO.setDevEffectiveRate(devEffectiveRate);
rMpDevEvaluateDetailVO.setDevEffectiveRate(NumberUtil.round(devEffectiveRate,2).doubleValue());
//终端指标完整率
double devTargetRate = list.stream().filter(item -> terminalMap.get(item.getDeviceId()).getDeviceModel().equals(key))
.mapToDouble(RMpDevEvaluateDetail::getDevTargetRate).average().orElse(0);
rMpDevEvaluateDetailVO.setDevTargetRate(devTargetRate);
rMpDevEvaluateDetailVO.setDevTargetRate(NumberUtil.round(devTargetRate,2).doubleValue());
//终端数据完整率
double devDataRate = list.stream().filter(item -> terminalMap.get(item.getDeviceId()).getDeviceModel().equals(key))
.mapToDouble(RMpDevEvaluateDetail::getDevDataRate).average().orElse(0);
rMpDevEvaluateDetailVO.setDevDataRate(devDataRate);
rMpDevEvaluateDetailVO.setDevDataRate(NumberUtil.round(devDataRate,2).doubleValue());
//综合评价
rMpDevEvaluateDetailVO.setAssessment(Double.parseDouble(df.format((devEffectiveRate + devTargetRate + devDataRate) / 3.0)));