提交 415b5057 authored 作者: zhoushaopan's avatar zhoushaopan

feat(用户使用报告模块): 优化代码。优化运行速度

优化代码。优化运行速度
上级 9039c4cb
...@@ -367,14 +367,23 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService { ...@@ -367,14 +367,23 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
// List<AllotBill> allotBillEntities = allotBillDao.findAll().stream() // List<AllotBill> allotBillEntities = allotBillDao.findAll().stream()
// .filter(allotBillEntity -> allotBillEntity.getAllotStatus() == 5 && userUtils.getCurrentUserUnitName().equals(allotBillEntity.getReceiveUnit()) && allotBillEntity.getReceiveTime().after(date) && allotBillEntity.getReceiveTime().before(date2)) // .filter(allotBillEntity -> allotBillEntity.getAllotStatus() == 5 && userUtils.getCurrentUserUnitName().equals(allotBillEntity.getReceiveUnit()) && allotBillEntity.getReceiveTime().after(date) && allotBillEntity.getReceiveTime().before(date2))
// .collect(toList()); // .collect(toList());
Integer unitId = userUtils.getCurrentUnitId();
List<AllotBill> allotBillEntities = allotBillDao.findAll().stream() List<AllotBill> allotBillEntities = allotBillDao.findAll().stream()
.filter(allotBillEntity -> allotBillEntity.getAllotStatus() == 5 && .filter(allotBillEntity -> allotBillEntity.getAllotStatus() == 5 &&
userUtils.getCurrentUnitId().equals(allotBillEntity.getReceiveUnitId()) unitId.equals(allotBillEntity.getReceiveUnitId())
&& allotBillEntity.getReceiveTime().after(date) && allotBillEntity.getReceiveTime().before(date2)) && allotBillEntity.getReceiveTime().after(date) && allotBillEntity.getReceiveTime().before(date2))
.collect(toList()); .collect(toList());
//筛选出配发给其它单位的账单 发起配发 //筛选出配发给其它单位的账单 发起配发
// List<AllotBill> allotBillEntities2 = allotBillDao.findAll().stream()
// .filter(allotBillEntity -> allotStatusList.contains(allotBillEntity.getAllotStatus()) &&
// userUtils.getCurrentUserUnitName().equals(userPublicService.findUnitsNameByUserId(allotBillEntity.getSendUseraId()))
// && allotBillEntity.getSendTime().after(date) && allotBillEntity.getSendTime().before(date2))
// .collect(toList());
String currentUserUnitName1 = userUtils.getCurrentUserUnitName();
List<AllotBill> allotBillEntities2 = allotBillDao.findAll().stream() List<AllotBill> allotBillEntities2 = allotBillDao.findAll().stream()
.filter(allotBillEntity -> allotStatusList.contains(allotBillEntity.getAllotStatus()) && userUtils.getCurrentUserUnitName().equals(userPublicService.findUnitsNameByUserId(allotBillEntity.getSendUseraId())) && allotBillEntity.getSendTime().after(date) && allotBillEntity.getSendTime().before(date2)) .filter(allotBillEntity -> allotStatusList.contains(allotBillEntity.getAllotStatus()) &&
currentUserUnitName1.equals(userPublicService.findUnitsNameByUserId(allotBillEntity.getSendUseraId()))
&& allotBillEntity.getSendTime().after(date) && allotBillEntity.getSendTime().before(date2))
.collect(toList()); .collect(toList());
//接收配发装备 //接收配发装备
if (allotBillEntities.size() > 0) { if (allotBillEntities.size() > 0) {
...@@ -397,7 +406,8 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService { ...@@ -397,7 +406,8 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
// .collect(toList()); // .collect(toList());
List<AllotBackBill> receiveAllotBackBills = allotBackBillDao.findAll().stream() List<AllotBackBill> receiveAllotBackBills = allotBackBillDao.findAll().stream()
.filter(allotBackBill -> allotBackBill.getBackStatus() == 3 && .filter(allotBackBill -> allotBackBill.getBackStatus() == 3 &&
userUtils.getCurrentUserUnitName().equals(unitsCache.findById(allotBackBill.getReceiveUnitId()).getName()) // userUtils.getCurrentUserUnitName().equals(unitsCache.findById(allotBackBill.getReceiveUnitId()).getName())
currentUserUnitName1.equals(unitsCache.findById(allotBackBill.getReceiveUnitId()).getName())
&& allotBackBill.getReceiveTime().after(date) && allotBackBill.getReceiveTime().before(date2)) && allotBackBill.getReceiveTime().after(date) && allotBackBill.getReceiveTime().before(date2))
.collect(toList()); .collect(toList());
//接收退回 //接收退回
...@@ -416,7 +426,8 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService { ...@@ -416,7 +426,8 @@ public class DeviceUseReportServiceImpl implements DeviceUseReportService {
// .collect(toList()); // .collect(toList());
List<AllotBackBill> sendAllotBackBills = allotBackBillDao.findAll().stream() List<AllotBackBill> sendAllotBackBills = allotBackBillDao.findAll().stream()
.filter(allotBackBill -> allotStatusBackList.contains(allotBackBill.getBackStatus()) && .filter(allotBackBill -> allotStatusBackList.contains(allotBackBill.getBackStatus()) &&
userUtils.getCurrentUserUnitName().equals(unitsCache.findById(allotBackBill.getSendUnitId()).getName()) // userUtils.getCurrentUserUnitName().equals(unitsCache.findById(allotBackBill.getSendUnitId()).getName())
currentUserUnitName1.equals(unitsCache.findById(allotBackBill.getSendUnitId()).getName())
&& allotBackBill.getSendTime().after(date) && allotBackBill.getSendTime().before(date2)) && allotBackBill.getSendTime().after(date) && allotBackBill.getSendTime().before(date2))
.collect(toList()); .collect(toList());
//发起退回 //发起退回
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论