Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zrch-risk-39
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Administrator
zrch-risk-39
Commits
043409dc
提交
043409dc
authored
2月 26, 2026
作者:
kxjia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改风险监控
上级
a8d17877
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
72 行增加
和
39 行删除
+72
-39
MetricStatReportController.java
...les/stm/metric/controller/MetricStatReportController.java
+1
-1
MetricReportServiceImpl.java
...ules/stm/metric/service/impl/MetricReportServiceImpl.java
+54
-5
MetricStatReportServiceImpl.java
.../stm/metric/service/impl/MetricStatReportServiceImpl.java
+12
-6
MetricStatReportMapper.xml
.../main/resources/mapping/metric/MetricStatReportMapper.xml
+5
-27
没有找到文件。
zrch-risk-server-39/jeecg-module-system/jeecg-module-stm/src/main/java/org/jeecg/modules/stm/metric/controller/MetricStatReportController.java
浏览文件 @
043409dc
...
@@ -377,7 +377,7 @@ public class MetricStatReportController extends JeecgController<MetricStatReport
...
@@ -377,7 +377,7 @@ public class MetricStatReportController extends JeecgController<MetricStatReport
private
String
getActionByRiskLevel
(
int
riskLevel
,
Map
<
String
,
Object
>
data
)
{
private
String
getActionByRiskLevel
(
int
riskLevel
,
Map
<
String
,
Object
>
data
)
{
switch
(
riskLevel
)
{
switch
(
riskLevel
)
{
case
0
:
return
"按时填写数据"
;
case
0
:
return
"按时填写数据"
;
case
1
:
return
"
继续监测
"
;
case
1
:
return
"
持续监测,确保风险指标处于绿色区间
"
;
case
2
:
return
data
.
get
(
"geWarnAct"
)
!=
null
?
data
.
get
(
"geWarnAct"
).
toString
()
:
""
;
case
2
:
return
data
.
get
(
"geWarnAct"
)
!=
null
?
data
.
get
(
"geWarnAct"
).
toString
()
:
""
;
case
3
:
return
data
.
get
(
"geTolAct"
)
!=
null
?
data
.
get
(
"geTolAct"
).
toString
()
:
""
;
case
3
:
return
data
.
get
(
"geTolAct"
)
!=
null
?
data
.
get
(
"geTolAct"
).
toString
()
:
""
;
default
:
return
""
;
default
:
return
""
;
...
...
zrch-risk-server-39/jeecg-module-system/jeecg-module-stm/src/main/java/org/jeecg/modules/stm/metric/service/impl/MetricReportServiceImpl.java
浏览文件 @
043409dc
...
@@ -114,32 +114,81 @@ public class MetricReportServiceImpl extends ServiceImpl<MetricReportMapper, Met
...
@@ -114,32 +114,81 @@ public class MetricReportServiceImpl extends ServiceImpl<MetricReportMapper, Met
private
Date
getGroupedDateByFrequency
(
int
frequency
,
Date
date
)
{
private
Date
getGroupedDateByFrequency
(
int
frequency
,
Date
date
)
{
Calendar
calendar
=
Calendar
.
getInstance
();
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
date
);
calendar
.
setTime
(
date
);
switch
(
frequency
)
{
switch
(
frequency
)
{
case
2
:
case
2
:
// 周
calendar
.
setFirstDayOfWeek
(
Calendar
.
MONDAY
);
calendar
.
setFirstDayOfWeek
(
Calendar
.
MONDAY
);
calendar
.
set
(
Calendar
.
DAY_OF_WEEK
,
calendar
.
getFirstDayOfWeek
());
calendar
.
set
(
Calendar
.
DAY_OF_WEEK
,
calendar
.
getFirstDayOfWeek
());
// 设置为当周的周日(一周的最后一天)
calendar
.
add
(
Calendar
.
DAY_OF_WEEK
,
6
);
break
;
break
;
case
3
:
case
3
:
// 月
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
// 先设置为当月第一天,再加一个月,然后减一天得到当月最后一天
calendar
.
add
(
Calendar
.
MONTH
,
1
);
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
break
;
break
;
case
4
:
case
4
:
// 季度
int
month
=
calendar
.
get
(
Calendar
.
MONTH
);
int
month
=
calendar
.
get
(
Calendar
.
MONTH
);
int
quarter
=
(
month
/
3
)
+
1
;
int
quarter
=
(
month
/
3
)
+
1
;
calendar
.
set
(
Calendar
.
MONTH
,
(
quarter
-
1
)
*
3
);
calendar
.
set
(
Calendar
.
MONTH
,
(
quarter
-
1
)
*
3
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
// 先设置为季度第一天,加3个月,然后减一天得到季度最后一天
calendar
.
add
(
Calendar
.
MONTH
,
3
);
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
break
;
break
;
case
5
:
case
5
:
// 半年
calendar
.
set
(
Calendar
.
MONTH
,
calendar
.
get
(
Calendar
.
MONTH
)
<
6
?
0
:
6
);
calendar
.
set
(
Calendar
.
MONTH
,
calendar
.
get
(
Calendar
.
MONTH
)
<
6
?
0
:
6
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
// 先设置为半年第一天,加6个月,然后减一天得到半年最后一天
calendar
.
add
(
Calendar
.
MONTH
,
6
);
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
break
;
break
;
case
6
:
case
6
:
// 年
calendar
.
set
(
Calendar
.
MONTH
,
0
);
calendar
.
set
(
Calendar
.
MONTH
,
0
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
// 先设置为当年第一天,加12个月(1年),然后减一天得到当年最后一天
calendar
.
add
(
Calendar
.
MONTH
,
12
);
calendar
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
break
;
break
;
}
}
return
calendar
.
getTime
();
return
calendar
.
getTime
();
}
}
// private Date getGroupedDateByFrequency(int frequency, Date date) {
// Calendar calendar = Calendar.getInstance();
// calendar.setTime(date);
// switch (frequency) {
// case 2:
// calendar.setFirstDayOfWeek(Calendar.MONDAY);
// calendar.set(Calendar.DAY_OF_WEEK, calendar.getFirstDayOfWeek());
// break;
// case 3:
// calendar.set(Calendar.DAY_OF_MONTH, 1);
// break;
// case 4:
// int month = calendar.get(Calendar.MONTH);
// int quarter = (month / 3) + 1;
// calendar.set(Calendar.MONTH, (quarter - 1) * 3);
// calendar.set(Calendar.DAY_OF_MONTH, 1);
// break;
// case 5:
// calendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH) < 6 ? 0 : 6);
// calendar.set(Calendar.DAY_OF_MONTH, 1);
// break;
// case 6:
// calendar.set(Calendar.MONTH, 0);
// calendar.set(Calendar.DAY_OF_MONTH, 1);
// break;
// }
// return calendar.getTime();
// }
private
MetricReport
createMetricReport
(
Date
fillTime
,
List
<
MetricReport
>
reports
,
String
formulas
,
MetricMonitorSet
monitorSet
,
LoginUser
user
)
{
private
MetricReport
createMetricReport
(
Date
fillTime
,
List
<
MetricReport
>
reports
,
String
formulas
,
MetricMonitorSet
monitorSet
,
LoginUser
user
)
{
String
newFormulas
=
formulas
;
String
newFormulas
=
formulas
;
for
(
MetricReport
report
:
reports
)
{
for
(
MetricReport
report
:
reports
)
{
...
...
zrch-risk-server-39/jeecg-module-system/jeecg-module-stm/src/main/java/org/jeecg/modules/stm/metric/service/impl/MetricStatReportServiceImpl.java
浏览文件 @
043409dc
...
@@ -6,6 +6,7 @@ import org.jeecg.modules.stm.metric.mapper.MetricStatReportMapper;
...
@@ -6,6 +6,7 @@ import org.jeecg.modules.stm.metric.mapper.MetricStatReportMapper;
import
org.jeecg.modules.stm.metric.service.IMetricStatReportService
;
import
org.jeecg.modules.stm.metric.service.IMetricStatReportService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.math.RoundingMode
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
import
java.util.*
;
import
java.util.*
;
...
@@ -97,7 +98,7 @@ public class MetricStatReportServiceImpl extends ServiceImpl<MetricStatReportMap
...
@@ -97,7 +98,7 @@ public class MetricStatReportServiceImpl extends ServiceImpl<MetricStatReportMap
}
}
}
}
riskMap
.
put
(
"其他"
,
level0
);
//
riskMap.put("其他", level0);
riskMap
.
put
(
"正常"
,
level1
);
riskMap
.
put
(
"正常"
,
level1
);
riskMap
.
put
(
"预警"
,
level2
);
riskMap
.
put
(
"预警"
,
level2
);
riskMap
.
put
(
"干预"
,
level3
);
riskMap
.
put
(
"干预"
,
level3
);
...
@@ -159,14 +160,14 @@ public class MetricStatReportServiceImpl extends ServiceImpl<MetricStatReportMap
...
@@ -159,14 +160,14 @@ public class MetricStatReportServiceImpl extends ServiceImpl<MetricStatReportMap
numMap
.
put
(
"low"
,
low
);
numMap
.
put
(
"low"
,
low
);
numMap
.
put
(
"middle"
,
middle
);
numMap
.
put
(
"middle"
,
middle
);
numMap
.
put
(
"hight"
,
hight
);
numMap
.
put
(
"hight"
,
hight
);
numMap
.
put
(
"other"
,
other
);
//
numMap.put("other",other);
numMap
.
put
(
"total"
,
total
);
numMap
.
put
(
"total"
,
total
);
retMap
.
put
(
"num"
,
numMap
);
retMap
.
put
(
"num"
,
numMap
);
percentMap
.
put
(
"low"
,
calculate
(
total
,
low
));
percentMap
.
put
(
"low"
,
calculate
(
total
,
low
));
percentMap
.
put
(
"middle"
,
calculate
(
total
,
middle
));
percentMap
.
put
(
"middle"
,
calculate
(
total
,
middle
));
percentMap
.
put
(
"hight"
,
calculate
(
total
,
hight
));
percentMap
.
put
(
"hight"
,
calculate
(
total
,
hight
));
percentMap
.
put
(
"other"
,
calculate
(
total
,
other
));;
//
percentMap.put("other",calculate(total,other));;
retMap
.
put
(
"percent"
,
percentMap
);
retMap
.
put
(
"percent"
,
percentMap
);
return
retMap
;
return
retMap
;
...
@@ -338,12 +339,17 @@ public class MetricStatReportServiceImpl extends ServiceImpl<MetricStatReportMap
...
@@ -338,12 +339,17 @@ public class MetricStatReportServiceImpl extends ServiceImpl<MetricStatReportMap
return
retList
;
return
retList
;
}
}
private
Float
calculate
(
Integer
total
,
Integer
val
)
{
private
Float
calculate
(
Integer
total
,
Integer
val
)
{
if
(
total
.
intValue
()
==
0
)
return
null
;
if
(
total
==
null
||
total
==
0
)
return
null
;
if
(
val
==
null
)
return
null
;
DecimalFormat
df
=
new
DecimalFormat
(
"#.##"
);
DecimalFormat
df
=
new
DecimalFormat
(
"#.##"
);
double
d
=
100.00
*
val
/
total
;
df
.
setRoundingMode
(
RoundingMode
.
HALF_UP
);
// 设置四舍五入
double
d
=
100.00
*
val
/
total
;
String
result
=
df
.
format
(
d
);
String
result
=
df
.
format
(
d
);
return
Float
.
parseFloat
(
result
);
return
Float
.
parseFloat
(
result
);
}
}
}
}
zrch-risk-server-39/jeecg-module-system/jeecg-module-stm/src/main/resources/mapping/metric/MetricStatReportMapper.xml
浏览文件 @
043409dc
...
@@ -13,14 +13,7 @@
...
@@ -13,14 +13,7 @@
AND D.level = 2
AND D.level = 2
WHERE B.mtrc_tp = 1
WHERE B.mtrc_tp = 1
AND C.risk_level IS NOT NULL
AND C.risk_level IS NOT NULL
AND (
AND DATE_FORMAT(C.fill_time, '%Y-%m') = DATE_FORMAT(#{query.endDate}, '%Y-%m')
B.coll_freq = #{query.tp}
OR
(
DATE_FORMAT(C.fill_time, '%Y-%m') = DATE_FORMAT(#{query.endDate}, '%Y-%m')
AND B.coll_freq
<>
#{query.tp}
)
)
GROUP BY D.domain_code, D.domain_name, C.risk_level
GROUP BY D.domain_code, D.domain_name, C.risk_level
</select>
</select>
<select
id=
"queryMetricStatByMtricClass"
resultType=
"java.util.Map"
>
<select
id=
"queryMetricStatByMtricClass"
resultType=
"java.util.Map"
>
...
@@ -36,17 +29,7 @@
...
@@ -36,17 +29,7 @@
WHERE B.mtrc_tp = 1
WHERE B.mtrc_tp = 1
AND (B.mtrc_class IS NULL OR E.dict_code = 'mtrc_class')
AND (B.mtrc_class IS NULL OR E.dict_code = 'mtrc_class')
AND C.risk_level IS NOT NULL
AND C.risk_level IS NOT NULL
AND (
AND C.fill_time BETWEEN #{query.stDate} AND #{query.endDate}
(
C.fill_time BETWEEN #{query.stDate} AND #{query.endDate}
AND B.coll_freq = #{query.tp}
)
OR
(
DATE_FORMAT(C.fill_time, '%Y-%m') = DATE_FORMAT(#{query.endDate}, '%Y-%m')
AND B.coll_freq
<>
#{query.tp}
)
)
GROUP BY B.mtrc_class, C.risk_level, D.item_text
GROUP BY B.mtrc_class, C.risk_level, D.item_text
</select>
</select>
<select
id=
"queryMetricStatDetail"
resultType=
"java.util.Map"
>
<select
id=
"queryMetricStatDetail"
resultType=
"java.util.Map"
>
...
@@ -62,17 +45,12 @@
...
@@ -62,17 +45,12 @@
C.fill_vals AS fillVals,
C.fill_vals AS fillVals,
B.unit
B.unit
FROM metric_monitor_set B
FROM metric_monitor_set B
INNER JOIN metric_report C ON B.mtrc_no = C.mtrc_no
INNER JOIN metric_report C ON B.mtrc_no = C.mtrc_no
INNER JOIN st_domain D ON B.domain_no LIKE CONCAT(D.domain_code, '%')
INNER JOIN st_domain D ON B.domain_no LIKE CONCAT(D.domain_code, '%')
AND D.level = 2
AND D.level = 2
WHERE B.mtrc_tp = 1
WHERE B.mtrc_tp = 1
AND C.risk_level IS NOT NULL
AND C.risk_level IS NOT NULL
AND
AND DATE_FORMAT(C.fill_time, '%Y-%m') = DATE_FORMAT(#{query.endDate}, '%Y-%m')
(B.coll_freq = #{query.tp} OR (
DATE_FORMAT(C.fill_time, '%Y-%m') = DATE_FORMAT(#{query.endDate}, '%Y-%m')
AND B.coll_freq
<>
#{query.tp}
)
)
ORDER BY B.mtrc_no ASC
ORDER BY B.mtrc_no ASC
</select>
</select>
<select
id=
"queryReportSubTitle"
resultType=
"java.util.Map"
>
<select
id=
"queryReportSubTitle"
resultType=
"java.util.Map"
>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论