Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
3e1d3f50
提交
3e1d3f50
authored
12月 27, 2021
作者:
zhoushaopan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(决算模块): 修改丢失bug,优化接口响应速度
修改丢失bug,优化接口响应速度
上级
118a39ff
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
34 行增加
和
10 行删除
+34
-10
FinalCheckServiceImpl.java
...device/finalcheck/service/impl/FinalCheckServiceImpl.java
+8
-3
DeviceUseReportServiceImpl.java
...ce/usereport/service/impl/DeviceUseReportServiceImpl.java
+26
-7
没有找到文件。
dev-finalcheck/src/main/java/com/tykj/dev/device/finalcheck/service/impl/FinalCheckServiceImpl.java
浏览文件 @
3e1d3f50
...
@@ -23,12 +23,14 @@ import com.tykj.dev.device.usereport.service.DeviceUseReportService;
...
@@ -23,12 +23,14 @@ import com.tykj.dev.device.usereport.service.DeviceUseReportService;
import
com.tykj.dev.device.usereport.subject.vo.DeviceStatistics
;
import
com.tykj.dev.device.usereport.subject.vo.DeviceStatistics
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.exception.ApiException
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
com.tykj.dev.misc.utils.JacksonUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StopWatch
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
...
@@ -48,6 +50,7 @@ import static java.util.stream.Collectors.toMap;
...
@@ -48,6 +50,7 @@ import static java.util.stream.Collectors.toMap;
* @since 2020/9/28 at 2:26 下午
* @since 2020/9/28 at 2:26 下午
*/
*/
@Service
@Service
@Slf4j
public
class
FinalCheckServiceImpl
implements
FinalCheckService
{
public
class
FinalCheckServiceImpl
implements
FinalCheckService
{
@Autowired
@Autowired
...
@@ -156,15 +159,16 @@ public class FinalCheckServiceImpl implements FinalCheckService {
...
@@ -156,15 +159,16 @@ public class FinalCheckServiceImpl implements FinalCheckService {
Map
<
String
,
DeviceStatistics
>
repairBackMap
=
dataService
.
getRepairBackStatistics
(
localDateToDate
(
startTime
),
localDateToDateEnd
(
endTime
))
Map
<
String
,
DeviceStatistics
>
repairBackMap
=
dataService
.
getRepairBackStatistics
(
localDateToDate
(
startTime
),
localDateToDateEnd
(
endTime
))
.
stream
()
.
stream
()
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()+
"Ǵ"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()+
"Ǵ"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
//销毁
//销毁
Map
<
String
,
DeviceStatistics
>
destroyMap
=
dataService
.
getDestroyStatistics
(
localDateToDate
(
startTime
),
localDateToDateEnd
(
endTime
))
Map
<
String
,
DeviceStatistics
>
destroyMap
=
dataService
.
getDestroyStatistics
(
localDateToDate
(
startTime
),
localDateToDateEnd
(
endTime
))
.
stream
()
.
stream
()
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()+
"Ǵ"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()+
"Ǵ"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
//报废
//报废
Map
<
String
,
DeviceStatistics
>
scrapMap
=
dataService
.
getScrapStatistics
(
localDateToDate
(
startTime
),
localDateToDateEnd
(
endTime
))
Map
<
String
,
DeviceStatistics
>
scrapMap
=
dataService
.
getScrapStatistics
(
localDateToDate
(
startTime
),
localDateToDateEnd
(
endTime
))
.
stream
()
.
stream
()
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()+
"Ǵ"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()+
"Ǵ"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
//退役
//退役
Map
<
String
,
DeviceStatistics
>
retireMap
=
dataService
.
getDecommissioningStatistics
(
localDateToDate
(
startTime
),
localDateToDateEnd
(
endTime
))
Map
<
String
,
DeviceStatistics
>
retireMap
=
dataService
.
getDecommissioningStatistics
(
localDateToDate
(
startTime
),
localDateToDateEnd
(
endTime
))
.
stream
()
.
stream
()
...
@@ -172,7 +176,7 @@ public class FinalCheckServiceImpl implements FinalCheckService {
...
@@ -172,7 +176,7 @@ public class FinalCheckServiceImpl implements FinalCheckService {
//丢失
//丢失
Map
<
String
,
DeviceStatistics
>
lossMap
=
dataService
.
getLossStatistics
(
localDateToDate
(
startTime
),
localDateToDateEnd
(
endTime
))
Map
<
String
,
DeviceStatistics
>
lossMap
=
dataService
.
getLossStatistics
(
localDateToDate
(
startTime
),
localDateToDateEnd
(
endTime
))
.
stream
()
.
stream
()
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()
+
"
G
"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
.
collect
(
toMap
(
deviceStatistics
->
deviceStatistics
.
getModel
()
+
"
Ǵ
"
+
deviceStatistics
.
getName
(),
Function
.
identity
()));
for
(
Map
.
Entry
<
String
,
List
<
DeviceLibrary
>>
entry
:
map
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
DeviceLibrary
>>
entry
:
map
.
entrySet
())
{
List
<
DeviceLibrary
>
vList
=
new
ArrayList
<>();
List
<
DeviceLibrary
>
vList
=
new
ArrayList
<>();
List
<
DeviceLibrary
>
hList
=
new
ArrayList
<>();
List
<
DeviceLibrary
>
hList
=
new
ArrayList
<>();
...
@@ -185,7 +189,7 @@ public class FinalCheckServiceImpl implements FinalCheckService {
...
@@ -185,7 +189,7 @@ public class FinalCheckServiceImpl implements FinalCheckService {
Integer
retire
=
retireMap
.
get
(
key
)
==
null
?
0
:
retireMap
.
get
(
key
).
getNum
();
Integer
retire
=
retireMap
.
get
(
key
)
==
null
?
0
:
retireMap
.
get
(
key
).
getNum
();
Integer
scrap
=
scrapMap
.
get
(
key
)
==
null
?
0
:
scrapMap
.
get
(
key
).
getNum
();
Integer
scrap
=
scrapMap
.
get
(
key
)
==
null
?
0
:
scrapMap
.
get
(
key
).
getNum
();
Integer
destroy
=
destroyMap
.
get
(
key
)
==
null
?
0
:
destroyMap
.
get
(
key
).
getNum
();
Integer
destroy
=
destroyMap
.
get
(
key
)
==
null
?
0
:
destroyMap
.
get
(
key
).
getNum
();
Integer
loss
=
lossMap
.
get
(
key
)
==
null
?
0
:
destroy
Map
.
get
(
key
).
getNum
();
Integer
loss
=
lossMap
.
get
(
key
)
==
null
?
0
:
loss
Map
.
get
(
key
).
getNum
();
v
=
entry
.
getValue
();
v
=
entry
.
getValue
();
if
(!
v
.
isEmpty
()){
if
(!
v
.
isEmpty
()){
//纵向
//纵向
...
@@ -202,6 +206,7 @@ public class FinalCheckServiceImpl implements FinalCheckService {
...
@@ -202,6 +206,7 @@ public class FinalCheckServiceImpl implements FinalCheckService {
detailList
.
add
(
new
FinalDetail
(
v
.
get
(
0
).
getModel
(),
v
.
get
(
0
).
getName
(),
vList
.
size
(),
hList
.
size
(),
0
,
otherList
.
size
(),
v
.
size
(),
detailList
.
add
(
new
FinalDetail
(
v
.
get
(
0
).
getModel
(),
v
.
get
(
0
).
getName
(),
vList
.
size
(),
hList
.
size
(),
0
,
otherList
.
size
(),
v
.
size
(),
0
,
storage
+
repairBack
,
sending
+
retire
,
scrap
,
report
.
getId
(),
loss
,
""
,
destroy
));
0
,
storage
+
repairBack
,
sending
+
retire
,
scrap
,
report
.
getId
(),
loss
,
""
,
destroy
));
}
}
for
(
Map
.
Entry
<
String
,
List
<
DeviceLibrary
>>
entry
:
outMap
.
entrySet
())
{
for
(
Map
.
Entry
<
String
,
List
<
DeviceLibrary
>>
entry
:
outMap
.
entrySet
())
{
String
key
=
entry
.
getKey
();
String
key
=
entry
.
getKey
();
if
(!
map
.
containsKey
(
key
)){
if
(!
map
.
containsKey
(
key
)){
...
...
dev-usereport/src/main/java/com/tykj/dev/device/usereport/service/impl/DeviceUseReportServiceImpl.java
浏览文件 @
3e1d3f50
...
@@ -28,6 +28,7 @@ import com.tykj.dev.device.sendback.service.RepelQueryService;
...
@@ -28,6 +28,7 @@ import com.tykj.dev.device.sendback.service.RepelQueryService;
import
com.tykj.dev.device.storage.repository.StorageBillDao
;
import
com.tykj.dev.device.storage.repository.StorageBillDao
;
import
com.tykj.dev.device.storage.subject.domin.StorageBill
;
import
com.tykj.dev.device.storage.subject.domin.StorageBill
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.cache.UnitsCache
;
import
com.tykj.dev.device.user.cache.UserCache
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.entity.Units
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
com.tykj.dev.device.user.subject.service.UnitsService
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
import
com.tykj.dev.device.user.subject.service.UserPublicService
;
...
@@ -47,6 +48,7 @@ import org.springframework.data.jpa.domain.Specification;
...
@@ -47,6 +48,7 @@ import org.springframework.data.jpa.domain.Specification;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.persistence.Transient
;
import
javax.persistence.Transient
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Field
;
import
java.util.*
;
import
java.util.*
;
...
@@ -107,9 +109,13 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
...
@@ -107,9 +109,13 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
@Autowired
@Autowired
private
UnitsService
unitsService
;
private
UnitsService
unitsService
;
@
Autowired
@
Resource
private
UnitsCache
unitsCache
;
private
UnitsCache
unitsCache
;
@Resource
private
UserCache
userCache
;
@Override
@Override
public
DeviceUseReport
addEntity
(
DeviceUseReport
deviceUseReportEntity
)
{
public
DeviceUseReport
addEntity
(
DeviceUseReport
deviceUseReportEntity
)
{
return
deviceUseReportDao
.
save
(
deviceUseReportEntity
);
return
deviceUseReportDao
.
save
(
deviceUseReportEntity
);
...
@@ -576,8 +582,14 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
...
@@ -576,8 +582,14 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
List
<
DeviceLibrary
>
deviceLibraries
=
new
ArrayList
<>();
List
<
DeviceLibrary
>
deviceLibraries
=
new
ArrayList
<>();
//获取这一段时间所有入库的装备
//获取这一段时间所有入库的装备
//筛选出日期范围内所有入库账单
//筛选出日期范围内所有入库账单
// List<StorageBill> storageBillEntities = storageBillDao.findAll().stream()
// .filter(storageBillEntity -> storageBillEntity.getStorageStatus() == 2 && userPublicService.findByUnitsToname(1).equals(userPublicService.findUnitsNameByUserId(storageBillEntity.getReceiveUseraId())) && storageBillEntity.getUpdateTime().after(startDate) && storageBillEntity.getUpdateTime().before(endDate))
// .collect(toList());
String
byUnitsToname
=
userPublicService
.
findByUnitsToname
(
1
);
List
<
StorageBill
>
storageBillEntities
=
storageBillDao
.
findAll
().
stream
()
List
<
StorageBill
>
storageBillEntities
=
storageBillDao
.
findAll
().
stream
()
.
filter
(
storageBillEntity
->
storageBillEntity
.
getStorageStatus
()
==
2
&&
userPublicService
.
findByUnitsToname
(
1
).
equals
(
userPublicService
.
findUnitsNameByUserId
(
storageBillEntity
.
getReceiveUseraId
()))
&&
storageBillEntity
.
getUpdateTime
().
after
(
startDate
)
&&
storageBillEntity
.
getUpdateTime
().
before
(
endDate
))
.
filter
(
storageBillEntity
->
storageBillEntity
.
getStorageStatus
()
==
2
&&
byUnitsToname
.
equals
(
userPublicService
.
findUnitsNameByUserId
(
storageBillEntity
.
getReceiveUseraId
()))
&&
storageBillEntity
.
getUpdateTime
().
after
(
startDate
)
&&
storageBillEntity
.
getUpdateTime
().
before
(
endDate
))
.
collect
(
toList
());
.
collect
(
toList
());
//获取所有入库的装备
//获取所有入库的装备
if
(
storageBillEntities
.
size
()
>
0
)
{
if
(
storageBillEntities
.
size
()
>
0
)
{
...
@@ -611,12 +623,14 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
...
@@ -611,12 +623,14 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
// List<RepairSendBill> repairSendBills = repairSendBillDao.findAll().stream()
// List<RepairSendBill> repairSendBills = repairSendBillDao.findAll().stream()
// .filter(repairSendBill -> repairSendBill.getRepairStatus() == 5 && userPublicService.findByUnitsToname(1).equals(repairSendBill.getSendUnit()) && repairSendBill.getSendTime().after(startDate) && repairSendBill.getSendTime().before(endDate))
// .filter(repairSendBill -> repairSendBill.getRepairStatus() == 5 && userPublicService.findByUnitsToname(1).equals(repairSendBill.getSendUnit()) && repairSendBill.getSendTime().after(startDate) && repairSendBill.getSendTime().before(endDate))
// .collect(toList());
// .collect(toList());
String
byUnitsToname
=
userPublicService
.
findByUnitsToname
(
1
);
List
<
RepairSendBill
>
repairSendBills
=
repairSendBillDao
.
findAll
().
stream
()
List
<
RepairSendBill
>
repairSendBills
=
repairSendBillDao
.
findAll
().
stream
()
.
filter
(
repairSendBill
->
repairSendBill
.
getRepairStatus
()
==
5
&&
.
filter
(
repairSendBill
->
repairSendBill
.
getRepairStatus
()
==
5
&&
userPublicService
.
findByUnitsToname
(
1
)
.
equals
(
unitsCache
.
findById
(
repairSendBill
.
getSendUnitId
()).
getName
())
&&
byUnitsToname
.
equals
(
unitsCache
.
findById
(
repairSendBill
.
getSendUnitId
()).
getName
())
&&
repairSendBill
.
getSendTime
().
after
(
startDate
)
&&
repairSendBill
.
getSendTime
().
before
(
endDate
))
repairSendBill
.
getSendTime
().
after
(
startDate
)
&&
repairSendBill
.
getSendTime
().
before
(
endDate
))
.
collect
(
toList
());
.
collect
(
toList
());
//获取所有维修的装备
//获取所有维修的装备
List
<
Integer
>
ids
=
new
ArrayList
<>();
if
(
repairSendBills
.
size
()
>
0
)
{
if
(
repairSendBills
.
size
()
>
0
)
{
for
(
RepairSendBill
s
:
repairSendBills
)
{
for
(
RepairSendBill
s
:
repairSendBills
)
{
// String[] strings = s.getRepairDeviceCheckResult().split("x");
// String[] strings = s.getRepairDeviceCheckResult().split("x");
...
@@ -626,12 +640,14 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
...
@@ -626,12 +640,14 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
//出库无误装备
//出库无误装备
if
(
"1"
.
equals
(
s1
.
substring
(
s1
.
length
()
-
1
)))
{
if
(
"1"
.
equals
(
s1
.
substring
(
s1
.
length
()
-
1
)))
{
Integer
id
=
Integer
.
parseInt
(
s1
.
substring
(
0
,
s1
.
length
()
-
1
));
Integer
id
=
Integer
.
parseInt
(
s1
.
substring
(
0
,
s1
.
length
()
-
1
));
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
ids
.
add
(
id
);
deviceLibraries
.
add
(
deviceLibraryEntity
);
// DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
// deviceLibraries.add(deviceLibraryEntity);
}
}
}
}
}
}
}
}
deviceLibraries
.
addAll
(
deviceLibraryService
.
findAllByIds
(
ids
));
}
}
return
getDeviceStatistics
(
deviceLibraries
);
return
getDeviceStatistics
(
deviceLibraries
);
}
}
...
@@ -647,6 +663,7 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
...
@@ -647,6 +663,7 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
userPublicService
.
findByUnitsToname
(
1
).
equals
(
unitsCache
.
findById
(
repairBackBill
.
getReceiveUnitId
()).
getName
())
&&
repairBackBill
.
getCreateTime
().
after
(
startDate
)
&&
repairBackBill
.
getCreateTime
().
before
(
endDate
))
userPublicService
.
findByUnitsToname
(
1
).
equals
(
unitsCache
.
findById
(
repairBackBill
.
getReceiveUnitId
()).
getName
())
&&
repairBackBill
.
getCreateTime
().
after
(
startDate
)
&&
repairBackBill
.
getCreateTime
().
before
(
endDate
))
.
collect
(
toList
());
.
collect
(
toList
());
//获取所有的装备维修退回的
//获取所有的装备维修退回的
List
<
Integer
>
ids
=
new
ArrayList
<>();
if
(
backBills
.
size
()>
0
){
if
(
backBills
.
size
()>
0
){
for
(
RepairBackBill
backBill
:
backBills
)
{
for
(
RepairBackBill
backBill
:
backBills
)
{
String
[]
strings
=
backBill
.
getBackCheckDetail
().
split
(
"x"
);
String
[]
strings
=
backBill
.
getBackCheckDetail
().
split
(
"x"
);
...
@@ -655,12 +672,14 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
...
@@ -655,12 +672,14 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
//出库无误装备
//出库无误装备
if
(
"1"
.
equals
(
s1
.
substring
(
s1
.
length
()
-
1
)))
{
if
(
"1"
.
equals
(
s1
.
substring
(
s1
.
length
()
-
1
)))
{
Integer
id
=
Integer
.
parseInt
(
s1
.
substring
(
0
,
s1
.
length
()
-
1
));
Integer
id
=
Integer
.
parseInt
(
s1
.
substring
(
0
,
s1
.
length
()
-
1
));
DeviceLibrary
deviceLibraryEntity
=
deviceLibraryService
.
getOne
(
id
);
ids
.
add
(
id
);
deviceLibraries
.
add
(
deviceLibraryEntity
);
// DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
// deviceLibraries.add(deviceLibraryEntity);
}
}
}
}
}
}
}
}
deviceLibraries
.
addAll
(
deviceLibraryService
.
findAllByIds
(
ids
));
}
}
return
getDeviceStatistics
(
deviceLibraries
);
return
getDeviceStatistics
(
deviceLibraries
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论