Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zhengyuan-danger-chemistry-manage
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
耿迪迪
zhengyuan-danger-chemistry-manage
Commits
53a9cd14
Commit
53a9cd14
authored
Jan 06, 2023
by
耿迪迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
隐患统计问题修改 gengdidi
parent
65a65910
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
72 deletions
+102
-72
HiddenStatVO.java
...c/main/java/com/zehong/system/domain/vo/HiddenStatVO.java
+3
-3
TStaningBookServiceImpl.java
...m/zehong/system/service/impl/TStaningBookServiceImpl.java
+75
-60
TStaningBookMapper.xml
...m/src/main/resources/mapper/system/TStaningBookMapper.xml
+2
-2
index.vue
danger-manage-web/src/views/system/hiddenStat/index.vue
+22
-7
No files found.
danger-manage-system/src/main/java/com/zehong/system/domain/vo/HiddenStatVO.java
View file @
53a9cd14
...
...
@@ -5,7 +5,7 @@ public class HiddenStatVO {
/**
* 隐患发现月份
*/
private
int
month
;
private
String
month
;
/**
* 发现隐患数量
...
...
@@ -17,11 +17,11 @@ public class HiddenStatVO {
*/
private
int
rectifiedCount
;
public
int
getMonth
()
{
public
String
getMonth
()
{
return
month
;
}
public
void
setMonth
(
int
month
)
{
public
void
setMonth
(
String
month
)
{
this
.
month
=
month
;
}
...
...
danger-manage-system/src/main/java/com/zehong/system/service/impl/TStaningBookServiceImpl.java
View file @
53a9cd14
package
com
.
zehong
.
system
.
service
.
impl
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
com.zehong.common.core.domain.entity.SysDept
;
import
com.zehong.common.utils.DateUtils
;
import
com.zehong.system.domain.T
HiddenTroubleWor
k
;
import
com.zehong.system.domain.T
StaningBoo
k
;
import
com.zehong.system.domain.vo.HiddenStatVO
;
import
com.zehong.system.mapper.SysDeptMapper
;
import
com.zehong.system.mapper.THiddenTroubleWorkMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.zehong.system.mapper.TStaningBookMapper
;
import
com.zehong.system.domain.TStaningBook
;
import
com.zehong.system.service.ITStaningBookService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
/**
* 隐患台账Service业务层处理
...
...
@@ -24,6 +24,7 @@ import com.zehong.system.service.ITStaningBookService;
@Service
public
class
TStaningBookServiceImpl
implements
ITStaningBookService
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
TStaningBookServiceImpl
.
class
);
@Autowired
private
TStaningBookMapper
tStaningBookMapper
;
@Autowired
...
...
@@ -124,62 +125,76 @@ public class TStaningBookServiceImpl implements ITStaningBookService
@Override
public
Map
<
String
,
List
>
hiddenStat
(
Integer
troubleLevel
,
Date
beginTime
,
Date
endTime
){
Map
<
String
,
List
>
result
=
new
HashMap
<>(
16
);
List
<
HiddenStatVO
>
barData
=
tStaningBookMapper
.
hiddenBarStat
(
troubleLevel
,
beginTime
,
endTime
);
//柱状图月份数据
List
<
String
>
months
=
new
ArrayList
<>();
//柱状图隐患数量
List
<
Integer
>
hiddens
=
new
ArrayList
<>();
//柱状图整改数量
List
<
Integer
>
rectifieds
=
new
ArrayList
<>();
for
(
HiddenStatVO
hidden
:
barData
){
months
.
add
(
changeMonth
(
hidden
.
getMonth
()));
hiddens
.
add
(
hidden
.
getHiddenCount
());
rectifieds
.
add
(
hidden
.
getRectifiedCount
());
try
{
List
<
HiddenStatVO
>
barData
=
tStaningBookMapper
.
hiddenBarStat
(
troubleLevel
,
beginTime
,
endTime
);
//柱状图月份数据
List
<
String
>
months
=
getMonthBetweenDate
(
beginTime
,
endTime
);
//柱状图隐患数量
List
<
Integer
>
hiddens
=
new
ArrayList
<>();
//柱状图整改数量
List
<
Integer
>
rectifieds
=
new
ArrayList
<>();
for
(
String
month
:
months
){
boolean
isHas
=
false
;
for
(
HiddenStatVO
hidden
:
barData
){
if
(
month
.
equals
(
hidden
.
getMonth
())){
isHas
=
true
;
hiddens
.
add
(
hidden
.
getHiddenCount
());
rectifieds
.
add
(
hidden
.
getRectifiedCount
());
break
;
}
}
if
(!
isHas
){
hiddens
.
add
(
0
);
rectifieds
.
add
(
0
);
}
}
result
.
put
(
"months"
,
months
);
result
.
put
(
"hiddens"
,
hiddens
);
result
.
put
(
"rectifieds"
,
rectifieds
);
//环状统计图
Map
<
String
,
Integer
>
pieData
=
tStaningBookMapper
.
hiddenPieStat
(
troubleLevel
,
beginTime
,
endTime
);
List
<
Map
<
String
,
Object
>>
pieResult
=
new
ArrayList
<>();
Map
<
String
,
Object
>
rectifiedMap
=
new
HashMap
<>(
16
);
rectifiedMap
.
put
(
"name"
,
"已整改"
);
rectifiedMap
.
put
(
"value"
,
pieData
.
get
(
"rectifiedCount"
));
pieResult
.
add
(
rectifiedMap
);
Map
<
String
,
Object
>
stayRectifiedMap
=
new
HashMap
<>(
16
);
stayRectifiedMap
.
put
(
"name"
,
"未整改"
);
stayRectifiedMap
.
put
(
"value"
,
pieData
.
get
(
"stayRectifiedCount"
));
pieResult
.
add
(
stayRectifiedMap
);
result
.
put
(
"pieData"
,
pieResult
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"隐患统计错误:"
+
e
);
}
result
.
put
(
"months"
,
months
);
result
.
put
(
"hiddens"
,
hiddens
);
result
.
put
(
"rectifieds"
,
rectifieds
);
//环状统计图
Map
<
String
,
Integer
>
pieData
=
tStaningBookMapper
.
hiddenPieStat
(
troubleLevel
,
beginTime
,
endTime
);
List
<
Map
<
String
,
Object
>>
pieResult
=
new
ArrayList
<>();
Map
<
String
,
Object
>
rectifiedMap
=
new
HashMap
<>(
16
);
rectifiedMap
.
put
(
"name"
,
"已整改"
);
rectifiedMap
.
put
(
"value"
,
pieData
.
get
(
"rectifiedCount"
));
pieResult
.
add
(
rectifiedMap
);
Map
<
String
,
Object
>
stayRectifiedMap
=
new
HashMap
<>(
16
);
stayRectifiedMap
.
put
(
"name"
,
"未整改"
);
stayRectifiedMap
.
put
(
"value"
,
pieData
.
get
(
"stayRectifiedCount"
));
pieResult
.
add
(
stayRectifiedMap
);
result
.
put
(
"pieData"
,
pieResult
);
return
result
;
}
private
String
changeMonth
(
int
month
){
switch
(
month
){
case
1
:
return
"一月"
;
case
2
:
return
"二月"
;
case
3
:
return
"三月"
;
case
4
:
return
"四月"
;
case
5
:
return
"五月"
;
case
6
:
return
"六月"
;
case
7
:
return
"七月"
;
case
8
:
return
"八月"
;
case
9
:
return
"九月"
;
case
10
:
return
"十月"
;
case
11
:
return
"十一月"
;
default
:
return
"十二月"
;
/**
* 获取两个日期之间的所有月份 (年月)
*
* @param startTime
* @param endTime
* @return:YYYY-MM
*/
private
List
<
String
>
getMonthBetweenDate
(
Date
startTime
,
Date
endTime
){
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM"
);
// 声明保存日期集合
List
<
String
>
list
=
new
ArrayList
<
String
>();
//用Calendar 进行日期比较判断
Calendar
calendar
=
Calendar
.
getInstance
();
while
(
startTime
.
getTime
()<=
endTime
.
getTime
()){
// 把日期添加到集合
list
.
add
(
sdf
.
format
(
startTime
));
// 设置日期
calendar
.
setTime
(
startTime
);
//把日期增加一天
calendar
.
add
(
Calendar
.
MONTH
,
1
);
// 获取增加后的日期
startTime
=
calendar
.
getTime
();
}
return
list
;
}
}
danger-manage-system/src/main/resources/mapper/system/TStaningBookMapper.xml
View file @
53a9cd14
...
...
@@ -200,7 +200,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"hiddenBarStat"
resultType=
"HiddenStatVO"
>
SELECT
IFNULL(
MONTH(find_time
),0) AS month,
IFNULL(
DATE_FORMAT(find_time,'%Y-%m'
),0) AS month,
IFNULL(count(1),0) hiddenCount,
IFNULL(sum(CASE state WHEN '2' THEN 1 ELSE 0 END),0) AS rectifiedCount
FROM
...
...
@@ -213,7 +213,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"troubleLevel != null and troubleLevel != ''"
>
AND trouble_level = #{troubleLevel}
</if>
GROUP BY
MONTH(find_time
)
GROUP BY
DATE_FORMAT(find_time,'%Y-%m'
)
</select>
<select
id=
"hiddenPieStat"
resultType=
"java.util.Map"
>
...
...
danger-manage-web/src/views/system/hiddenStat/index.vue
View file @
53a9cd14
...
...
@@ -2,7 +2,7 @@
<div
class=
"hiddenStat"
>
<el-form
:model=
"queryParams"
:inline=
"true"
label-width=
"100px"
style=
"margin-top: 10px"
>
<el-form-item
label=
"隐患级别"
prop=
"hiddenLevel"
>
<el-select
v-model=
"queryParams.troubleLevel"
placeholder=
"请选择隐患级别"
>
<el-select
v-model=
"queryParams.troubleLevel"
placeholder=
"请选择隐患级别"
clearable
>
<el-option
v-for=
"dict in troubleLevelOptions"
:key=
"dict.dictValue"
...
...
@@ -50,7 +50,7 @@
closeHiddenBarData
:
[],
pieData
:
[],
troubleLevelOptions
:
[],
findTime
:
""
findTime
:
[
new
Date
().
getFullYear
()
+
"-01-01 00:00:00"
,
new
Date
().
getFullYear
()
+
"-12-31 23:59:59"
]
}
},
mounted
(){
...
...
@@ -75,11 +75,20 @@
},
xAxis
:
{
type
:
'category'
,
//data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
axisLabel
:
{
//x轴文字的配置
show
:
true
,
interval
:
0
,
//使x轴文字显示全
rotate
:
-
270
},
//data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
data
:
this
.
monthData
},
yAxis
:
{
type
:
'value'
type
:
'value'
,
axisLabel
:
{
interval
:
0
,
},
},
series
:
[
{
...
...
@@ -119,7 +128,7 @@
},
series
:
[
{
name
:
'
gun
'
,
name
:
'
隐患整改率
'
,
type
:
'pie'
,
radius
:
[
'40%'
,
'70%'
],
/*data: [
...
...
@@ -148,8 +157,14 @@
})
},
dateFormat
(
picker
){
this
.
queryParams
.
beginTime
=
picker
[
0
];
this
.
queryParams
.
endTime
=
picker
[
1
];
if
(
!
picker
){
this
.
findTime
=
[];
this
.
queryParams
.
beginTime
=
null
;
this
.
queryParams
.
endTime
=
null
;
}
else
{
this
.
queryParams
.
beginTime
=
picker
[
0
];
this
.
queryParams
.
endTime
=
picker
[
1
];
}
},
search
(){
this
.
getHiddenData
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment