Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
device-back
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
1
议题
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Matrix
device-back
Commits
af593568
提交
af593568
authored
6月 17, 2021
作者:
133
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[退役、报废、销毁] 决算相关接口提交
上级
c1b25f35
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
48 行增加
和
35 行删除
+48
-35
DeviceUseReportService.java
.../dev/device/usereport/service/DeviceUseReportService.java
+8
-0
DeviceUseReportServiceImpl.java
...ce/usereport/service/impl/DeviceUseReportServiceImpl.java
+40
-35
没有找到文件。
dev-usereport/src/main/java/com/tykj/dev/device/usereport/service/DeviceUseReportService.java
浏览文件 @
af593568
...
...
@@ -72,6 +72,13 @@ public interface DeviceUseReportService {
*/
List
<
DeviceStatistics
>
getDestroyStatistics
(
Date
startDate
,
Date
endDate
);
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return 这一段时间省退役的统计
*/
List
<
DeviceStatistics
>
getDecommissioningStatistics
(
Date
startDate
,
Date
endDate
);
/**
* @param startDate 开始时间
* @param endDate 结束时间
...
...
@@ -79,5 +86,6 @@ public interface DeviceUseReportService {
*/
List
<
DeviceStatistics
>
getScrapStatistics
(
Date
startDate
,
Date
endDate
);
void
delete
(
Integer
id
);
}
dev-usereport/src/main/java/com/tykj/dev/device/usereport/service/impl/DeviceUseReportServiceImpl.java
浏览文件 @
af593568
...
...
@@ -4,9 +4,11 @@ import com.github.wenhao.jpa.PredicateBuilder;
import
com.github.wenhao.jpa.Specifications
;
import
com.tykj.dev.blockcha.subject.entity.BcHash
;
import
com.tykj.dev.blockcha.subject.service.BlockChainUtil
;
import
com.tykj.dev.config.base.DeviceLifeStatus
;
import
com.tykj.dev.device.allot.repository.AllotBillDao
;
import
com.tykj.dev.device.allot.subject.domin.AllotBill
;
import
com.tykj.dev.device.destroy.repository.DeviceDestroyBillDao
;
import
com.tykj.dev.device.library.repository.DeviceLibraryDao
;
import
com.tykj.dev.device.library.service.DeviceLibraryService
;
import
com.tykj.dev.device.library.subject.domin.DeviceLibrary
;
import
com.tykj.dev.device.library.subject.vo.DeviceLibrarySelectVo
;
...
...
@@ -39,6 +41,7 @@ import org.springframework.stereotype.Service;
import
javax.persistence.Transient
;
import
java.lang.reflect.Field
;
import
java.time.LocalDate
;
import
java.util.*
;
import
static
java
.
util
.
stream
.
Collectors
.
groupingBy
;
...
...
@@ -65,6 +68,9 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
@Autowired
private
AllotBillDao
allotBillDao
;
@Autowired
DeviceLibraryDao
deviceLibraryDao
;
@Autowired
private
DeviceDestroyBillDao
deviceDestroyBillDao
;
...
...
@@ -308,28 +314,15 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
*/
@Override
public
List
<
DeviceStatistics
>
getDestroyStatistics
(
Date
startDate
,
Date
endDate
)
{
List
<
DeviceLibrary
>
deviceLibraries
=
new
ArrayList
<>();
//筛选出日期范围内所有销毁账单
// List<DeviceDestroyBill> deviceDestroyBills = deviceDestroyBillDao.findAll().stream()
// .filter(deviceDestroyBill -> deviceDestroyBill.getDestroyStatus() == 2 && deviceDestroyBill.getDestroyTime().after(startDate) && deviceDestroyBill.getDestroyTime().before(endDate))
// .collect(toList());
// //获取所有销毁的装备
// if (deviceDestroyBills.size() > 0) {
// for (DeviceDestroyBill s : deviceDestroyBills) {
// String[] strings = s.getDestroyDeviceDetail().split("x");
// for (String s1 : strings) {
// if (s1.length() >= 2) {
// //出库无误装备
// if ("1".equals(s1.substring(s1.length() - 1))) {
// Integer id = Integer.parseInt(s1.substring(0, s1.length() - 1));
// DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
// deviceLibraries.add(deviceLibraryEntity);
// }
// }
// }
// }
// }
return
getDeviceStatistics
(
deviceLibraries
);
List
<
DeviceLibrary
>
libraryList
=
deviceLibraryDao
.
findAll
(
getPredicateBuilder
(
startDate
,
endDate
,
DeviceLifeStatus
.
DESTROYED
));
return
getDeviceStatistics
(
libraryList
);
}
@Override
public
List
<
DeviceStatistics
>
getDecommissioningStatistics
(
Date
startDate
,
Date
endDate
)
{
List
<
DeviceLibrary
>
libraryList
=
deviceLibraryDao
.
findAll
(
getPredicateBuilder
(
startDate
,
endDate
,
DeviceLifeStatus
.
RETIRE
));
return
getDeviceStatistics
(
libraryList
);
}
/**
...
...
@@ -339,19 +332,8 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
*/
@Override
public
List
<
DeviceStatistics
>
getScrapStatistics
(
Date
startDate
,
Date
endDate
)
{
List
<
DeviceLibrary
>
deviceLibraries
=
new
ArrayList
<>();
//筛选出日期范围内所有报废账单
List
<
ScrapBill
>
scrapBills
=
scrapBillDao
.
findAll
().
stream
()
.
filter
(
scrapBill
->
scrapBill
.
getScrapUnit
().
equals
(
userPublicService
.
findByUnitsToname
(
1
))
&&
scrapBill
.
getScrapTime
().
after
(
startDate
)
&&
scrapBill
.
getScrapTime
().
before
(
endDate
))
.
collect
(
toList
());
//获取所有报废的装备
if
(
scrapBills
.
size
()
>
0
)
{
for
(
ScrapBill
s
:
scrapBills
)
{
List
<
Integer
>
integerList
=
StringSplitUtil
.
userIdSplit
(
s
.
getScrapDetail
());
integerList
.
forEach
(
integer
->
deviceLibraries
.
add
(
deviceLibraryService
.
getOne
(
integer
)));
}
}
return
getDeviceStatistics
(
deviceLibraries
);
List
<
DeviceLibrary
>
libraryList
=
deviceLibraryDao
.
findAll
(
getPredicateBuilder
(
startDate
,
endDate
,
DeviceLifeStatus
.
SCRAP_I
));
return
getDeviceStatistics
(
libraryList
);
}
@Override
...
...
@@ -383,6 +365,29 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
return
predicateBuilder
.
build
();
}
/**
* 销毁、报废、退役使用
* @param startTime 开始时间
* @param endTime 结束时间
* @return 装备集合
*/
private
Specification
<
DeviceLibrary
>
getPredicateBuilder
(
Date
startTime
,
Date
endTime
,
DeviceLifeStatus
deviceLifeStatus
)
{
PredicateBuilder
<
DeviceLibrary
>
predicateBuilder
=
Specifications
.
and
();
if
(
startTime
!=
null
){
predicateBuilder
.
gt
(
"updateTime"
,
startTime
);
}
if
(
endTime
!=
null
){
predicateBuilder
.
lt
(
"updateTime"
,
endTime
);
}
predicateBuilder
.
eq
(
"lifeStatus"
,
deviceLifeStatus
.
id
);
return
predicateBuilder
.
build
();
}
/**
* 按型号组合统计
*/
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论