Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
db360dfe
提交
db360dfe
authored
10月 20, 2020
作者:
邓砥奕
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[统计分析]实现业务统计、告警统计service层
上级
f639093e
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
232 行增加
和
15 行删除
+232
-15
DeviceDetailVo.java
...com/tykj/dev/device/repair/subject/vo/DeviceDetailVo.java
+2
-0
DeviceRetiredController.java
...ev/device/retired/controller/DeviceRetiredController.java
+6
-2
DeviceRetiredDetailResultVo.java
...device/retired/entity/vo/DeviceRetiredDetailResultVo.java
+4
-4
pom.xml
dev-statistical/pom.xml
+13
-0
StatisticalController.java
...ykj/dev/statistical/controller/StatisticalController.java
+14
-4
StatisticalService.java
.../com/tykj/dev/statistical/service/StatisticalService.java
+12
-4
StatisticalServiceImpl.java
.../dev/statistical/service/impl/StatisticalServiceImpl.java
+168
-0
AlarmSituation.java
...main/java/com/tykj/dev/statistical/vo/AlarmSituation.java
+8
-1
BusinessSituation.java
...n/java/com/tykj/dev/statistical/vo/BusinessSituation.java
+5
-0
没有找到文件。
dev-repair/src/main/java/com/tykj/dev/device/repair/subject/vo/DeviceDetailVo.java
浏览文件 @
db360dfe
...
...
@@ -4,12 +4,14 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author dengdiyi
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
"维修装备详情类"
)
public
class
DeviceDetailVo
{
...
...
dev-retired/src/main/java/com/tykj/dev/device/retired/controller/DeviceRetiredController.java
浏览文件 @
db360dfe
...
...
@@ -17,6 +17,7 @@ import com.tykj.dev.device.task.service.TaskLogService;
import
com.tykj.dev.device.task.service.TaskService
;
import
com.tykj.dev.device.task.subject.bto.TaskBto
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.device.user.util.AuthenticationUtils
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.base.StatusEnum
;
...
...
@@ -65,6 +66,9 @@ public class DeviceRetiredController {
@Autowired
private
AuthenticationUtils
AuthenticationUtils
;
@Autowired
private
UserPublicService
userPublicService
;
public
DeviceRetiredController
(
DeviceRetiredBillService
deviceRetiredBillService
,
TaskService
taskService
,
PackingLibraryService
packingLibraryService
,
DeviceLibraryService
deviceLibraryService
,
DeviceLogService
deviceLogService
,
TaskLogService
taskLogService
)
{
this
.
deviceRetiredBillService
=
deviceRetiredBillService
;
this
.
taskService
=
taskService
;
...
...
@@ -118,8 +122,8 @@ public class DeviceRetiredController {
deviceRetiredDetailResultVo
.
getPackingLibrarys
().
add
(
packingLibraryService
.
getOne
(
deviceId
));
}
deviceRetiredDetailResultVo
.
setRetiredStatus
(
deviceRetiredBillEntity
.
getRetiredStatus
());
deviceRetiredDetailResultVo
.
setConfirmUser
Id
(
deviceRetiredBillEntity
.
getUserBId
());
deviceRetiredDetailResultVo
.
setStartUser
Id
(
deviceRetiredBillEntity
.
getUserAId
());
deviceRetiredDetailResultVo
.
setConfirmUser
(
userPublicService
.
getOne
(
deviceRetiredBillEntity
.
getUserBId
()).
getName
());
deviceRetiredDetailResultVo
.
setStartUser
(
userPublicService
.
getOne
(
deviceRetiredBillEntity
.
getUserAId
()).
getName
());
return
ResultUtil
.
success
(
deviceRetiredDetailResultVo
);
}
...
...
dev-retired/src/main/java/com/tykj/dev/device/retired/entity/vo/DeviceRetiredDetailResultVo.java
浏览文件 @
db360dfe
...
...
@@ -18,11 +18,11 @@ import java.util.List;
@ApiModel
(
"销毁详情查询类"
)
public
class
DeviceRetiredDetailResultVo
{
@ApiModelProperty
(
value
=
"发起人
ID
"
,
example
=
"1"
)
private
Integer
startUserId
;
@ApiModelProperty
(
value
=
"发起人"
,
example
=
"1"
)
private
String
startUser
;
@ApiModelProperty
(
value
=
"审核人
ID
"
,
example
=
"1"
)
private
Integer
confirmUserId
;
@ApiModelProperty
(
value
=
"审核人"
,
example
=
"1"
)
private
String
confirmUser
;
@ApiModelProperty
(
value
=
"销毁状态(0:销毁装备出库待审核,1:销毁装备出库审核失败,2:已销毁)"
)
private
Integer
retiredStatus
;
...
...
dev-statistical/pom.xml
浏览文件 @
db360dfe
...
...
@@ -32,6 +32,18 @@
<groupId>
com.tykj
</groupId>
<artifactId>
dev-selfcheck
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj.dev
</groupId>
<artifactId>
rfid
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-task
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-finalcheck
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
dev-statistical/src/main/java/com/tykj/dev/statistical/controller/StatisticalController.java
浏览文件 @
db360dfe
...
...
@@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -97,12 +98,21 @@ public class StatisticalController {
/**
* 查询告警情况
* @return
各市装备生命状态
对象集合
* @return
全省告警统计
对象集合
*/
@GetMapping
(
"/alarmSituation"
)
public
ResponseEntity
selectAlarmSituation
(){
return
ResponseEntity
.
ok
(
statisticalService
.
getRfidWarning
());
}
return
ResponseEntity
.
ok
(
new
AlarmSituation
());
/**
* 查询各市告警情况
* @return 各市告警情况对象集合
*/
@GetMapping
(
"/alarmSituation/detail"
)
public
ResponseEntity
selectAlarmSituationDetail
(){
List
<
AlarmSituation
>
alarmSituations
=
new
ArrayList
<>();
return
ResponseEntity
.
ok
(
alarmSituations
);
}
/**
...
...
@@ -110,7 +120,7 @@ public class StatisticalController {
* @return 各市装备生命状态对象集合
*/
@GetMapping
(
"/businessSituation/{type}"
)
public
ResponseEntity
selectBusinessSituation
(
@PathVariable
Integer
type
){
return
ResponseEntity
.
ok
(
new
BusinessSituation
(
));
public
ResponseEntity
selectBusinessSituation
(
@PathVariable
Integer
type
)
throws
ParseException
{
return
ResponseEntity
.
ok
(
statisticalService
.
getBusinessNum
(
type
));
}
}
dev-statistical/src/main/java/com/tykj/dev/statistical/service/StatisticalService.java
浏览文件 @
db360dfe
package
com
.
tykj
.
dev
.
statistical
.
service
;
import
com.tykj.dev.statistical.vo.DevLifeSector
;
import
com.tykj.dev.statistical.vo.DevNum
;
import
com.tykj.dev.statistical.vo.SelfInspection
;
import
com.tykj.dev.statistical.vo.YearSelfInspection
;
import
com.tykj.dev.statistical.vo.*
;
import
java.text.ParseException
;
import
java.util.List
;
/**
...
...
@@ -33,4 +31,14 @@ public interface StatisticalService {
*/
List
<
YearSelfInspection
>
getYearSelfCheck
();
/**
* 获取年度告警统计信息
*/
AlarmSituation
getRfidWarning
();
/**
* @param type 类型(1:上半年,2:下半年)
* 获取业务统计信息
*/
BusinessSituation
getBusinessNum
(
Integer
type
)
throws
ParseException
;
}
dev-statistical/src/main/java/com/tykj/dev/statistical/service/impl/StatisticalServiceImpl.java
浏览文件 @
db360dfe
package
com
.
tykj
.
dev
.
statistical
.
service
.
impl
;
import
com.tykj.dev.device.finalcheck.entity.domain.FinalReport
;
import
com.tykj.dev.device.finalcheck.repisotry.FinalReportDao
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.selfcheck.base.SelfCheckSchedulerTask
;
import
com.tykj.dev.device.selfcheck.repository.SelfCheckBillDao
;
import
com.tykj.dev.device.selfcheck.subject.domin.SelfCheckBill
;
import
com.tykj.dev.device.task.repository.TaskDao
;
import
com.tykj.dev.device.task.subject.domin.Task
;
import
com.tykj.dev.device.user.subject.dao.AreaDao
;
import
com.tykj.dev.device.user.subject.dao.UnitsDao
;
import
com.tykj.dev.device.user.subject.entity.Area
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.rfid.entity.domin.LibraryWarningLog
;
import
com.tykj.dev.rfid.repository.LibraryWarningLogDao
;
import
com.tykj.dev.statistical.service.StatisticalService
;
import
com.tykj.dev.statistical.vo.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.time.ZoneId
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
...
...
@@ -40,6 +49,15 @@ public class StatisticalServiceImpl implements StatisticalService {
@Autowired
private
SelfCheckBillDao
selfCheckBillDao
;
@Autowired
private
LibraryWarningLogDao
libraryWarningLogDao
;
@Autowired
private
TaskDao
taskDao
;
@Autowired
private
FinalReportDao
finalReportDao
;
/**
* 获取装备统计信息
*/
...
...
@@ -213,6 +231,68 @@ public class StatisticalServiceImpl implements StatisticalService {
return
yearSelfInspections
;
}
/**
* 获取年度告警统计信息
*/
@Override
public
AlarmSituation
getRfidWarning
()
{
AlarmSituation
alarmSituation
=
new
AlarmSituation
();
//获取当前年份
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
());
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
//获取本年度所有告警记录
List
<
LibraryWarningLog
>
libraryWarningLogs
=
libraryWarningLogDao
.
findAll
().
stream
()
.
filter
(
libraryWarningLog
->
{
calendar
.
setTime
(
libraryWarningLog
.
getCreateTime
());
return
year
==
calendar
.
get
(
Calendar
.
YEAR
);
})
.
collect
(
Collectors
.
toList
());
alarmSituation
.
setAlarmCount
(
libraryWarningLogs
.
size
());
//获取盘库异常数量
int
inventoryNum
=
(
int
)
libraryWarningLogs
.
stream
().
filter
(
libraryWarningLog
->
libraryWarningLog
.
getWarningType
()==
2
).
count
();
//获取未处理数量
int
unHandleNum
=
(
int
)
libraryWarningLogs
.
stream
().
filter
(
libraryWarningLog
->
libraryWarningLog
.
getWarningHandle
()==
0
).
count
();
alarmSituation
.
setInventoryCount
(
inventoryNum
);
alarmSituation
.
setInOutCount
(
libraryWarningLogs
.
size
()-
inventoryNum
);
alarmSituation
.
setUntreatedCount
(
unHandleNum
);
return
alarmSituation
;
}
/**
* @param type 类型(1:上半年,2:下半年)
* 获取业务统计信息
*/
@Override
public
BusinessSituation
getBusinessNum
(
Integer
type
)
throws
ParseException
{
List
<
Task
>
tasks
;
List
<
FinalReport
>
finalReports
;
//上半年
if
(
type
==
1
){
List
<
Date
>
dates
=
getFirstHalfYear
();
tasks
=
taskDao
.
findAll
().
stream
()
.
filter
(
task
->
task
.
getCreateTime
().
after
(
dates
.
get
(
0
))&&
task
.
getCreateTime
().
before
(
dates
.
get
(
1
))&&(
task
.
getParentTaskId
()==
null
||
task
.
getParentTaskId
()==
0
))
.
collect
(
Collectors
.
toList
());
finalReports
=
finalReportDao
.
findAll
().
stream
()
.
filter
(
finalReport
->
Date
.
from
(
finalReport
.
getCreateTime
().
atZone
(
ZoneId
.
systemDefault
()).
toInstant
()).
after
(
dates
.
get
(
0
))&&
Date
.
from
(
finalReport
.
getCreateTime
().
atZone
(
ZoneId
.
systemDefault
()).
toInstant
()).
before
(
dates
.
get
(
1
)))
.
collect
(
Collectors
.
toList
());
return
countBusiness
(
tasks
,
finalReports
);
}
else
if
(
type
==
2
){
List
<
Date
>
dates
=
getLastHalfYear
();
tasks
=
taskDao
.
findAll
().
stream
()
.
filter
(
task
->
task
.
getCreateTime
().
after
(
dates
.
get
(
0
))&&
task
.
getCreateTime
().
before
(
dates
.
get
(
1
))&&(
task
.
getParentTaskId
()==
null
||
task
.
getParentTaskId
()==
0
))
.
collect
(
Collectors
.
toList
());
finalReports
=
finalReportDao
.
findAll
().
stream
()
.
filter
(
finalReport
->
Date
.
from
(
finalReport
.
getCreateTime
().
atZone
(
ZoneId
.
systemDefault
()).
toInstant
()).
after
(
dates
.
get
(
0
))&&
Date
.
from
(
finalReport
.
getCreateTime
().
atZone
(
ZoneId
.
systemDefault
()).
toInstant
()).
before
(
dates
.
get
(
1
)))
.
collect
(
Collectors
.
toList
());
return
countBusiness
(
tasks
,
finalReports
);
}
else
{
throw
new
ApiException
(
"type只能为1或2"
);
}
}
/**
* @param devLifeSector 装备生命状态添统计
* @param deviceLibraries 统计装备
...
...
@@ -307,4 +387,92 @@ public class StatisticalServiceImpl implements StatisticalService {
perQuarter
.
setNoCompleteCount
(
undoAreas
.
size
());
perQuarter
.
setCompleteCount
(
sonAreas
.
size
()-
undoAreas
.
size
());
}
/**
* 获取上半年开始时间和结束时间
*/
private
List
<
Date
>
getFirstHalfYear
()
throws
ParseException
{
List
<
Date
>
dates
=
new
ArrayList
<>();
//获取当前年份
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
());
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
SimpleDateFormat
dateformat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
date1
=
dateformat
.
parse
(
year
+
"-1-1"
);
Date
date2
=
dateformat
.
parse
(
year
+
"-7-1"
);
dates
.
add
(
date1
);
dates
.
add
(
date2
);
return
dates
;
}
/**
* 获取下半年开始时间和结束时间
*/
private
List
<
Date
>
getLastHalfYear
()
throws
ParseException
{
List
<
Date
>
dates
=
new
ArrayList
<>();
//获取当前年份
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
setTime
(
new
Date
());
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
SimpleDateFormat
dateformat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
date1
=
dateformat
.
parse
(
year
+
"-7-1"
);
Date
date2
=
dateformat
.
parse
((
year
+
1
)+
"-1-1"
);
dates
.
add
(
date1
);
dates
.
add
(
date2
);
return
dates
;
}
private
BusinessSituation
countBusiness
(
List
<
Task
>
tasks
,
List
<
FinalReport
>
finalReports
){
int
withCount
=
0
;
int
sendRepelCount
=
0
;
int
selfInspection
=
0
;
int
verification
=
0
;
int
train
=
0
;
int
finalAccounts
=
finalReports
.
size
();
int
putStorage
=
0
;
int
apply
=
0
;
int
fielding
=
0
;
int
backPack
=
0
;
int
destruction
=
0
;
int
maintenance
=
0
;
for
(
Task
task:
tasks
)
{
switch
(
task
.
getBusinessType
()){
case
1
:
fielding
++;
break
;
case
2
:
putStorage
++;
break
;
case
3
:
withCount
++;
break
;
case
4
:
selfInspection
++;
break
;
case
5
:
maintenance
++;
break
;
case
7
:
verification
++;
break
;
case
9
:
apply
++;
break
;
case
13
:
train
++;
break
;
case
14
:
destruction
++;
break
;
case
15
:
backPack
++;
break
;
case
16
:
sendRepelCount
++;
break
;
default
:
break
;
}
}
return
new
BusinessSituation
(
withCount
,
sendRepelCount
,
selfInspection
,
verification
,
train
,
finalAccounts
,
putStorage
,
apply
,
fielding
,
backPack
,
destruction
,
maintenance
);
}
}
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/AlarmSituation.java
浏览文件 @
db360dfe
package
com
.
tykj
.
dev
.
statistical
.
vo
;
import
lombok.Data
;
/**
* @author zjm
* @version 1.0.0
...
...
@@ -7,6 +9,7 @@ package com.tykj.dev.statistical.vo;
* @Description 告警概况
* @createTime 2020年10月16日 13:50:00
*/
@Data
public
class
AlarmSituation
{
/**
* 总数
...
...
@@ -15,7 +18,7 @@ public class AlarmSituation {
/**
* 出入
*/
private
Integer
inOutCo
nu
t
;
private
Integer
inOutCo
un
t
;
/**
*盘库
*/
...
...
@@ -24,4 +27,8 @@ public class AlarmSituation {
* 未处理
*/
private
Integer
untreatedCount
;
/**
* 告警地区
*/
private
String
area
;
}
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/BusinessSituation.java
浏览文件 @
db360dfe
package
com
.
tykj
.
dev
.
statistical
.
vo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
/**
* @author zjm
* @version 1.0.0
...
...
@@ -7,6 +10,8 @@ package com.tykj.dev.statistical.vo;
* @Description TODO
* @createTime 2020年10月16日 13:21:00
*/
@Data
@AllArgsConstructor
public
class
BusinessSituation
{
/**
* 配发
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论