Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
515efe4d
提交
515efe4d
authored
10月 29, 2020
作者:
邓砥奕
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[统计分析]增加了首页自查、核查数量统计
上级
45f55d18
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
325 行增加
和
11 行删除
+325
-11
CacheBeanConfig.java
...dev/device/confirmcheck/entity/cache/CacheBeanConfig.java
+20
-0
DeviceSeqUtil.java
.../src/main/java/com/tykj/dev/misc/utils/DeviceSeqUtil.java
+113
-0
pom.xml
dev-statistical/pom.xml
+5
-0
StatisticalController.java
...ykj/dev/statistical/controller/StatisticalController.java
+10
-0
StatisticalService.java
.../com/tykj/dev/statistical/service/StatisticalService.java
+5
-0
StatisticalServiceImpl.java
.../dev/statistical/service/impl/StatisticalServiceImpl.java
+56
-1
Check.java
...ical/src/main/java/com/tykj/dev/statistical/vo/Check.java
+25
-0
StorageBillController.java
.../dev/device/storage/controller/StorageBillController.java
+7
-0
TaskServiceImpl.java
...om/tykj/dev/device/task/service/impl/TaskServiceImpl.java
+13
-5
UnitsCache.java
.../main/java/com/tykj/dev/device/user/cache/UnitsCache.java
+31
-0
UserCache.java
...c/main/java/com/tykj/dev/device/user/cache/UserCache.java
+30
-0
UserPublicServiceImpl.java
...vice/user/subject/service/impl/UserPublicServiceImpl.java
+10
-5
没有找到文件。
dev-confirmcheck/src/main/java/com/tykj/dev/device/confirmcheck/entity/cache/CacheBeanConfig.java
浏览文件 @
515efe4d
package
com
.
tykj
.
dev
.
device
.
confirmcheck
.
entity
.
cache
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.cache.UserCache
;
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.dao.UserDao
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
...
...
@@ -17,8 +21,24 @@ public class CacheBeanConfig {
@Autowired
private
AreaDao
areaRepo
;
@Autowired
private
UserDao
userDao
;
@Autowired
private
UnitsDao
unitsDao
;
@Bean
public
AreaCache
initAreaCache
()
{
return
new
AreaCache
(
areaRepo
.
findAll
());
}
@Bean
public
UserCache
initUserCache
()
{
return
new
UserCache
(
userDao
.
findAll
());
}
@Bean
public
UnitsCache
initUnitCache
()
{
return
new
UnitsCache
(
unitsDao
.
findAll
());
}
}
dev-misc/src/main/java/com/tykj/dev/misc/utils/DeviceSeqUtil.java
0 → 100644
浏览文件 @
515efe4d
package
com
.
tykj
.
dev
.
misc
.
utils
;
import
com.tykj.dev.misc.exception.ApiException
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author dengdiyi
* 装备序列号生成工具类
*/
public
class
DeviceSeqUtil
{
/**
* @param num 入库数量
* @param s 序列号区间字符串
* @return 生成的序列号列表
* 根据序列号规则和区间字符串按顺序生成一段序列号
*/
public
static
List
<
String
>
createDeviceSeqs
(
String
s
,
Integer
num
){
List
<
String
>
seqs
=
new
ArrayList
<>();
if
(
s
!=
null
&&
s
.
length
()>
0
)
{
//按,分隔多个区间
String
[]
strings
=
s
.
split
(
","
);
if
(
strings
.
length
==
1
){
String
num1
=
strings
[
0
].
replaceAll
(
".*[^\\d](?=(\\d+))"
,
""
);
int
minSeq
=
Integer
.
parseInt
(
num1
);
for
(
int
i
=
0
;
i
<
num
;
i
++){
StringBuffer
stringBuffer
=
new
StringBuffer
();
//拼接数字之前的字符串
stringBuffer
.
append
(
s
,
0
,
s
.
length
()-
num1
.
length
());
//将数字按长度格式化,缺位补0
String
codeFormat
=
"%0"
+
num1
.
length
()
+
"d"
;
stringBuffer
.
append
(
String
.
format
(
codeFormat
,
minSeq
));
seqs
.
add
(
stringBuffer
.
toString
());
minSeq
++;
}
}
else
{
for
(
String
str
:
strings
)
{
if
(
str
.
length
()
>
0
)
{
if
(
isSingle
(
str
))
{
seqs
.
add
(
str
);
}
else
{
seqs
.
addAll
(
getIntervalSeqs
(
str
));
}
}
}
}
}
return
seqs
;
}
/**
* @param s 区间字符串
* 判断是单个序列号还是序列号区间,若是单个序列号返回true,否则返回false
*/
private
static
boolean
isSingle
(
String
s
){
return
!
s
.
contains
(
"-"
);
}
/**
* @param s 区间字符串
* 根据区间字符串获取该区间序列号列表
*/
private
static
List
<
String
>
getIntervalSeqs
(
String
s
){
List
<
String
>
stringList
=
new
ArrayList
<>();
//根据-分隔
String
[]
strings
=
s
.
split
(
"-"
);
if
(
strings
.
length
==
2
){
//左区间字符串
String
s1
=
strings
[
0
];
//右区间字符串
String
s2
=
strings
[
1
];
if
(
s1
.
length
()!=
s2
.
length
()){
throw
new
ApiException
(
"序列号区间前面字符位数不相同"
);
}
else
{
//获得左区间最后几位的数字
String
num1
=
s1
.
replaceAll
(
".*[^\\d](?=(\\d+))"
,
""
);
//获得右区间最后几位的数字
String
num2
=
s2
.
replaceAll
(
".*[^\\d](?=(\\d+))"
,
""
);
if
(
num1
.
length
()
!=
num2
.
length
()){
throw
new
ApiException
(
"序列号区间后面数字位数不相同"
);
}
else
{
int
minSeq
=
Integer
.
parseInt
(
num1
);
int
maxSeq
=
Integer
.
parseInt
(
num2
);
if
(
maxSeq
<
minSeq
){
throw
new
ApiException
(
"前区间数字大于后区间"
);
}
else
{
while
(
minSeq
<=
maxSeq
){
StringBuffer
stringBuffer
=
new
StringBuffer
();
//拼接数字之前的字符串
stringBuffer
.
append
(
s1
,
0
,
s1
.
length
()-
num1
.
length
());
//将数字按长度格式化,缺位补0
String
codeFormat
=
"%0"
+
num1
.
length
()
+
"d"
;
stringBuffer
.
append
(
String
.
format
(
codeFormat
,
minSeq
));
stringList
.
add
(
stringBuffer
.
toString
());
minSeq
++;
}
}
}
}
}
else
{
throw
new
ApiException
(
"序列号区间包含多个-"
);
}
return
stringList
;
}
}
dev-statistical/pom.xml
浏览文件 @
515efe4d
...
...
@@ -44,6 +44,10 @@
<groupId>
com.tykj
</groupId>
<artifactId>
dev-finalcheck
</artifactId>
</dependency>
<dependency>
<groupId>
com.tykj
</groupId>
<artifactId>
dev-confirmcheck
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
dev-statistical/src/main/java/com/tykj/dev/statistical/controller/StatisticalController.java
浏览文件 @
515efe4d
...
...
@@ -133,4 +133,14 @@ public class StatisticalController {
public
ResponseEntity
selectBusinessSituation
(
@PathVariable
Integer
type
)
throws
ParseException
{
return
ResponseEntity
.
ok
(
statisticalService
.
getBusinessNum
(
type
));
}
/**
* 查询各市最近一次自查核查数量
* @return 各市自查核查数量对象集合
*/
@ApiOperation
(
value
=
"查询各市最近一次自查核查数量"
)
@GetMapping
(
"/checkNum"
)
public
ResponseEntity
selectCheckNum
(){
return
ResponseEntity
.
ok
(
statisticalService
.
getCheckNum
());
}
}
dev-statistical/src/main/java/com/tykj/dev/statistical/service/StatisticalService.java
浏览文件 @
515efe4d
...
...
@@ -46,4 +46,9 @@ public interface StatisticalService {
* 获取本季度各市告警统计信息
*/
List
<
AlarmSituation
>
getRfidWarningDetail
();
/**
* 获取各市最近一次自查和核查装备数量
*/
List
<
Check
>
getCheckNum
();
}
dev-statistical/src/main/java/com/tykj/dev/statistical/service/impl/StatisticalServiceImpl.java
浏览文件 @
515efe4d
package
com
.
tykj
.
dev
.
statistical
.
service
.
impl
;
import
com.tykj.dev.device.confirmcheck.entity.cache.AreaCache
;
import
com.tykj.dev.device.confirmcheck.entity.domain.DeviceCheckDetail
;
import
com.tykj.dev.device.confirmcheck.repository.DeviceCheckDetailDao
;
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
;
...
...
@@ -13,6 +16,8 @@ import com.tykj.dev.device.task.subject.bto.TaskBto;
import
com.tykj.dev.device.task.subject.domin.Task
;
import
com.tykj.dev.device.task.subject.vo.TaskSelectVo
;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.cache.UserCache
;
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
;
...
...
@@ -56,6 +61,15 @@ public class StatisticalServiceImpl implements StatisticalService {
@Autowired
private
TaskService
taskService
;
@Autowired
private
UnitsCache
unitsCache
;
@Autowired
private
AreaCache
areaCache
;
@Autowired
private
DeviceCheckDetailDao
deviceCheckDetailDao
;
/**
* 获取装备统计信息
*/
...
...
@@ -67,7 +81,7 @@ public class StatisticalServiceImpl implements StatisticalService {
//获取所有市
List
<
Area
>
areas
=
areaDao
.
findAreasByType
(
2
);
//获取所有单位
List
<
Units
>
units
=
units
Dao
.
findAll
();
List
<
Units
>
units
=
units
Cache
.
findAll
();
//统计各市装备数量
areas
.
forEach
(
area
->
{
DevNum
devNum
=
new
DevNum
();
...
...
@@ -343,6 +357,47 @@ public class StatisticalServiceImpl implements StatisticalService {
return
alarmSituations
;
}
/**
* 获取各市最近一次自查和核查装备数量
*/
@Override
public
List
<
Check
>
getCheckNum
()
{
List
<
Check
>
checks
=
new
ArrayList
<>();
//获取所有自查单
List
<
SelfCheckBill
>
selfCheckBills
=
selfCheckBillDao
.
findAll
();
//获取所有核查单
List
<
DeviceCheckDetail
>
deviceCheckDetails
=
deviceCheckDetailDao
.
findAll
();
//获取所有市
List
<
Area
>
areas
=
areaDao
.
findAreasByType
(
2
);
//遍历市,找到最近完成的自查和核查账单
for
(
Area
a:
areas
)
{
Check
check
=
new
Check
();
check
.
setAreaName
(
a
.
getName
());
List
<
Units
>
units
=
unitsDao
.
findAllByAreaId
(
a
.
getId
());
if
(
units
.
size
()==
1
)
{
//获取市单位名称
String
unitName
=
unitsDao
.
findAllByAreaId
(
a
.
getId
()).
get
(
0
).
getName
();
//筛选出当前单位已完成的自查和核查账单,按更新时间排序
List
<
SelfCheckBill
>
selfCheckBillList
=
selfCheckBills
.
stream
()
.
filter
(
selfCheckBill
->
selfCheckBill
.
getCheckUnit
().
equals
(
unitName
)
&&
selfCheckBill
.
getCheckedCount
()
!=
null
)
.
sorted
(
Comparator
.
comparing
(
SelfCheckBill:
:
getUpdateTime
).
reversed
())
.
collect
(
Collectors
.
toList
());
List
<
DeviceCheckDetail
>
deviceCheckDetailList
=
deviceCheckDetails
.
stream
()
.
filter
(
deviceCheckDetail
->
deviceCheckDetail
.
getCheckUnit
().
equals
(
unitName
)
&&
deviceCheckDetail
.
getCheckedCount
()
!=
null
)
.
sorted
(
Comparator
.
comparing
(
DeviceCheckDetail:
:
getUpdateTime
).
reversed
())
.
collect
(
Collectors
.
toList
());
if
(!
selfCheckBillList
.
isEmpty
())
{
check
.
setSelfCheckCount
(
selfCheckBillList
.
get
(
0
).
getCheckedCount
());
}
if
(!
deviceCheckDetailList
.
isEmpty
())
{
check
.
setConfirmCheckCount
(
deviceCheckDetailList
.
get
(
0
).
getCheckedCount
());
}
}
checks
.
add
(
check
);
}
return
checks
;
}
/**
* @param devLifeSector 装备生命状态添统计
* @param deviceLibraries 统计装备
...
...
dev-statistical/src/main/java/com/tykj/dev/statistical/vo/Check.java
0 → 100644
浏览文件 @
515efe4d
package
com
.
tykj
.
dev
.
statistical
.
vo
;
import
lombok.Data
;
/**
* @author dengdiyi
* 区域最近一次自查和核查数量统计
*/
@Data
public
class
Check
{
/**
* 市 名称
*/
private
String
areaName
;
/**
* 自查数量
*/
private
Integer
selfCheckCount
=
0
;
/**
* 核查数量
*/
private
Integer
confirmCheckCount
=
0
;
}
dev-storage/src/main/java/com/tykj/dev/device/storage/controller/StorageBillController.java
浏览文件 @
515efe4d
...
...
@@ -22,6 +22,7 @@ import com.tykj.dev.device.user.subject.service.UserPublicService;
import
com.tykj.dev.device.user.util.UserUtils
;
import
com.tykj.dev.misc.base.BusinessEnum
;
import
com.tykj.dev.misc.base.StatusEnum
;
import
com.tykj.dev.misc.utils.DeviceSeqUtil
;
import
com.tykj.dev.misc.utils.ResultUtil
;
import
com.tykj.dev.misc.utils.StringSplitUtil
;
import
com.tykj.dev.socket.MyWebSocket
;
...
...
@@ -72,6 +73,12 @@ public class StorageBillController {
@Autowired
private
MyWebSocket
myWebSocket
;
@ApiOperation
(
value
=
"获取序列号区间列表"
,
notes
=
"可以通过这个接口获取序列号区间列表"
)
@GetMapping
(
value
=
"/getSeq/{num}/{string}"
)
public
ResponseEntity
getSeq
(
@PathVariable
(
"string"
)
String
s
,
@PathVariable
(
"num"
)
Integer
num
){
return
ResultUtil
.
success
(
DeviceSeqUtil
.
createDeviceSeqs
(
s
,
num
));
}
@ApiOperation
(
value
=
"选择入库型号数量"
,
notes
=
"可以通过这个接口选择入库型号数量"
)
@PostMapping
(
value
=
"/addStorageDetail"
)
public
ResponseEntity
addStorageDetail
(
@RequestBody
List
<
StorageBillDetailVo
>
list
)
{
...
...
dev-task/src/main/java/com/tykj/dev/device/task/service/impl/TaskServiceImpl.java
浏览文件 @
515efe4d
...
...
@@ -13,6 +13,8 @@ import com.tykj.dev.device.task.subject.domin.TaskLog;
import
com.tykj.dev.device.task.subject.vo.TaskSelectVo
;
import
com.tykj.dev.device.task.subject.vo.TaskUserVo
;
import
com.tykj.dev.device.task.utils.TaskUtils
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.cache.UserCache
;
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.UserUtils
;
...
...
@@ -51,6 +53,12 @@ public class TaskServiceImpl implements TaskService {
@Autowired
private
TaskLogDao
taskLogDao
;
@Autowired
private
UserCache
userCache
;
@Autowired
private
UnitsCache
unitsCache
;
/**
* <p>业务进行到下一个状态</p>
* <li>不指定待办用户</li>
...
...
@@ -378,12 +386,12 @@ public class TaskServiceImpl implements TaskService {
Integer
userId3
=
userIds
.
get
(
taskUserVo
.
getCurrentPoint
());
//当前指针userId大于0,待办人即当前id
if
(
userId3
>
0
)
{
taskUserVo
.
setProcessingUser
(
user
PublicService
.
getOne
(
userId3
).
getName
());
taskUserVo
.
setProcessingUser
(
user
Cache
.
findById
(
userId3
).
getName
());
}
//当前指针userId等于0,待办人为所属单位下所有用户
else
if
(
userId3
==
0
&&
taskUserVo
.
getOwnUnit
()!=
null
){
StringBuffer
stringBuffer
=
new
StringBuffer
();
List
<
User
>
users
=
user
PublicService
.
getAllUser
();
List
<
User
>
users
=
user
Cache
.
findAll
();
users
.
stream
().
filter
(
user
->
user
.
getUnitsId
().
equals
(
taskUserVo
.
getOwnUnit
())).
forEach
(
user
->
{
stringBuffer
.
append
(
user
.
getName
()).
append
(
","
);
});
...
...
@@ -405,7 +413,7 @@ public class TaskServiceImpl implements TaskService {
}
}
//判断是否需要按发起时间排序
if
(
taskSelectVo
.
getOrders
()
!=
null
)
{
if
(
!
taskSelectVo
.
getOrders
().
isEmpty
()
)
{
if
(
"createTime"
.
equals
(
taskSelectVo
.
getOrders
().
get
(
0
).
getCoulmn
()))
{
if
(
"ASC"
.
equals
(
taskSelectVo
.
getOrders
().
get
(
0
).
getDirection
().
toString
()))
{
return
taskUtils
.
orderByCreateTimeAsc2
(
taskUserVos
);
...
...
@@ -622,12 +630,12 @@ public class TaskServiceImpl implements TaskService {
Integer
userId3
=
userIds
.
get
(
taskUserVo
.
getCurrentPoint
());
//当前指针userId大于0,待办人即当前id
if
(
userId3
>
0
)
{
taskUserVo
.
setProcessingUser
(
user
PublicService
.
getOne
(
userId3
).
getName
());
taskUserVo
.
setProcessingUser
(
user
Cache
.
findById
(
userId3
).
getName
());
}
//当前指针userId等于0,待办人为所属单位下所有用户
else
if
(
userId3
==
0
&&
taskUserVo
.
getOwnUnit
()!=
null
){
StringBuffer
stringBuffer
=
new
StringBuffer
();
List
<
User
>
users
=
user
PublicService
.
getAllUser
();
List
<
User
>
users
=
user
Cache
.
findAll
();
users
.
stream
().
filter
(
user
->
user
.
getUnitsId
().
equals
(
taskUserVo
.
getOwnUnit
())).
forEach
(
user
->
{
stringBuffer
.
append
(
user
.
getName
()).
append
(
","
);
});
...
...
dev-user/src/main/java/com/tykj/dev/device/user/cache/UnitsCache.java
0 → 100644
浏览文件 @
515efe4d
package
com
.
tykj
.
dev
.
device
.
user
.
cache
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
public
class
UnitsCache
{
private
Map
<
Integer
,
Units
>
idMap
;
public
UnitsCache
(
List
<
Units
>
unitsList
){
this
.
idMap
=
unitsList
.
stream
().
collect
(
Collectors
.
toMap
(
Units:
:
getUnitId
,
Function
.
identity
()));
}
public
Map
<
Integer
,
Units
>
getIdMap
()
{
return
idMap
;
}
public
Units
findById
(
Integer
id
)
{
return
idMap
.
get
(
id
);
}
public
List
<
Units
>
findAll
(){
return
new
ArrayList
<>(
idMap
.
values
());
}
}
dev-user/src/main/java/com/tykj/dev/device/user/cache/UserCache.java
0 → 100644
浏览文件 @
515efe4d
package
com
.
tykj
.
dev
.
device
.
user
.
cache
;
import
com.tykj.dev.device.user.subject.entity.User
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
public
class
UserCache
{
private
Map
<
Integer
,
User
>
idMap
;
public
UserCache
(
List
<
User
>
userList
){
this
.
idMap
=
userList
.
stream
().
collect
(
Collectors
.
toMap
(
User:
:
getUserId
,
Function
.
identity
()));
}
public
User
findById
(
Integer
id
)
{
return
idMap
.
get
(
id
);
}
public
Map
<
Integer
,
User
>
getIdMap
()
{
return
idMap
;
}
public
List
<
User
>
findAll
(){
return
new
ArrayList
<>(
idMap
.
values
());
}
}
dev-user/src/main/java/com/tykj/dev/device/user/subject/service/impl/UserPublicServiceImpl.java
浏览文件 @
515efe4d
package
com
.
tykj
.
dev
.
device
.
user
.
subject
.
service
.
impl
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.cache.UserCache
;
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.dao.UserDao
;
...
...
@@ -33,6 +35,12 @@ public class UserPublicServiceImpl implements UserPublicService {
@Autowired
AreaDao
areaDao
;
@Autowired
UserCache
userCache
;
@Autowired
UnitsCache
unitsCache
;
@Override
public
List
<
String
>
findByUnitNameDown
(
String
unitName
)
{
Units
units
=
unitsDao
.
findByName
(
unitName
);
...
...
@@ -71,11 +79,8 @@ public class UserPublicServiceImpl implements UserPublicService {
@Override
public
String
findUnitsNameByUserId
(
Integer
userId
)
{
Optional
<
User
>
resultEntity
=
userDao
.
findById
(
userId
);
if
(
resultEntity
.
isPresent
())
{
return
unitsDao
.
findById
(
resultEntity
.
get
().
getUnitsId
()).
get
().
getName
();
}
return
null
;
User
resultEntity
=
userCache
.
findById
(
userId
);
return
unitsCache
.
findById
(
resultEntity
.
getUnitsId
()).
getName
();
}
@Override
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论