|
@@ -78,102 +78,97 @@ public class SysDeptInvoiceServiceImpl extends ServiceImpl<SysDeptInvoiceMapper,
|
|
private final SysDeptRechargeMapper deptRechargeMapper;
|
|
private final SysDeptRechargeMapper deptRechargeMapper;
|
|
private final RedisTemplate redisTemplate;
|
|
private final RedisTemplate redisTemplate;
|
|
|
|
|
|
-// /**
|
|
|
|
-// * 园区-开票管理列表
|
|
|
|
-// *
|
|
|
|
-// * @param toScorePackagePage 分页参数
|
|
|
|
-// * @return 分页结果
|
|
|
|
-// */
|
|
|
|
-// @Override
|
|
|
|
-// public IPage<SysDeptInvoiceRelationVO> pageInvoiceForPark(Page<SysDeptInvoiceRelationVO> page, SysDeptInvoiceRequest.ToScorePackagePage toScorePackagePage) {
|
|
|
|
-//
|
|
|
|
-// Integer deptId = SecurityUtils.getUser().getDeptId();
|
|
|
|
-// List<SysJyEntRelation> jyEnts = jyEntRelationService.list(Wrappers.<SysJyEntRelation>lambdaQuery()
|
|
|
|
-// .eq(SysJyEntRelation::getJyDept, deptId));
|
|
|
|
-// if (CollUtil.isEmpty(jyEnts)) {
|
|
|
|
-// return page;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// // 查询园区关联的企业
|
|
|
|
-// Set<Integer> queryDeptIds = new HashSet<>();
|
|
|
|
-// Set<Integer> jyEntRelationDeptIds = jyEnts.stream().map(SysJyEntRelation::getEntDept).collect(Collectors.toSet());
|
|
|
|
-// List<SysDeptRelation> deptRelations = deptRelationService.list(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
|
|
-// .in(SysDeptRelation::getAncestor, jyEntRelationDeptIds)
|
|
|
|
-// .notIn(SysDeptRelation::getDescendant, jyEntRelationDeptIds));
|
|
|
|
-// if (CollUtil.isEmpty(deptRelations)) {
|
|
|
|
-// return page;
|
|
|
|
-// }
|
|
|
|
-// queryDeptIds.addAll(jyEntRelationDeptIds);
|
|
|
|
-//
|
|
|
|
-// Set<Integer> subDeptIds = deptRelations.stream().map(SysDeptRelation::getDescendant).collect(Collectors.toSet());
|
|
|
|
-// queryDeptIds.addAll(subDeptIds);
|
|
|
|
-// // 查询下级企业的信息
|
|
|
|
-// List<SysDeptRelation> subRelations = deptRelationService.list(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
|
|
-// .in(SysDeptRelation::getAncestor, subDeptIds));
|
|
|
|
-// if (CollUtil.isNotEmpty(subRelations)) {
|
|
|
|
-// Set<Integer> sub1DeptIds = subRelations.stream().map(SysDeptRelation::getDescendant).collect(Collectors.toSet());
|
|
|
|
-// queryDeptIds.addAll(sub1DeptIds);
|
|
|
|
-// // 查询下下级企业的信息
|
|
|
|
-// List<SysDeptRelation> sub2Relations = deptRelationService.list(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
|
|
-// .in(SysDeptRelation::getAncestor, sub1DeptIds));
|
|
|
|
-// if (CollUtil.isNotEmpty(sub2Relations)) {
|
|
|
|
-// Set<Integer> sub2DeptIds = sub2Relations.stream().map(SysDeptRelation::getDescendant).collect(Collectors.toSet());
|
|
|
|
-// queryDeptIds.addAll(sub2DeptIds);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// // 企业名称查询过滤
|
|
|
|
-// if (StrUtil.isNotEmpty(toScorePackagePage.getDeptName())) {
|
|
|
|
-// List<SysDept> queryLikeDepts = deptService.list(Wrappers.<SysDept>lambdaQuery()
|
|
|
|
-// .like(SysDept::getName, toScorePackagePage.getDeptName()));
|
|
|
|
-// if (CollUtil.isEmpty(queryLikeDepts)) {
|
|
|
|
-// return page;
|
|
|
|
-// }
|
|
|
|
-// Set<Integer> likeDeptIds = queryLikeDepts.stream().map(SysDept::getDeptId).collect(Collectors.toSet());
|
|
|
|
-// queryDeptIds.retainAll(likeDeptIds);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// IPage<SysDeptInvoiceRelationVO> relationVOIPage =
|
|
|
|
-// deptInvoiceRelationMapper.pageInvoiceScorePacakgeRelation(new Page<>(page.getCurrent(), page.getSize()), toScorePackagePage, queryDeptIds);
|
|
|
|
-//
|
|
|
|
-// List<SysDeptInvoiceRelationVO> records = relationVOIPage.getRecords();
|
|
|
|
-// if (CollUtil.isEmpty(records)) {
|
|
|
|
-// return page;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// // 积分包接单用户map
|
|
|
|
-// Map<String, String> packageUsersMap = new HashMap<>();
|
|
|
|
-// // 查领包记录
|
|
|
|
-// Set<String> packageIds = records.stream().map(SysDeptInvoiceRelationVO::getScorePackageId).collect(Collectors.toSet());
|
|
|
|
-// List<WmScorePackageStatus> scorePackageStatusList = scorePackageStatusMapper.selectList(Wrappers.<WmScorePackageStatus>lambdaQuery()
|
|
|
|
-// .in(WmScorePackageStatus::getPackageId, packageIds)
|
|
|
|
-// .eq(WmScorePackageStatus::getStatus, PackageStatusEnum.APPROVED.val()));
|
|
|
|
-// if (CollUtil.isNotEmpty(scorePackageStatusList)) {
|
|
|
|
-// // 查询领包记录的所有用户
|
|
|
|
-// Set<String> statusUserIds = scorePackageStatusList.stream().map(WmScorePackageStatus::getUserId).collect(Collectors.toSet());
|
|
|
|
-// List<SysUser> statusUsers = userService.listByIds(statusUserIds);
|
|
|
|
-// // 转为map(key-积分包id,value-领包用户逗号分隔)
|
|
|
|
-// Map<Integer, String> statusUserMap = statusUsers.stream().collect(Collectors.toMap(SysUser::getUserId, SysUser::getRealname));
|
|
|
|
-// packageUsersMap = scorePackageStatusList.stream()
|
|
|
|
-// .collect(Collectors.groupingBy(WmScorePackageStatus::getPackageId,
|
|
|
|
-// Collectors.mapping(wmScorePackageStatus ->
|
|
|
|
-// statusUserMap.getOrDefault(Integer.parseInt(wmScorePackageStatus.getUserId()), ""), Collectors.joining(","))));
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// // 查询积分包涉及的企业
|
|
|
|
-// Set<Integer> deptIds = records.stream().map(SysDeptInvoiceRelationVO::getDeptId).collect(Collectors.toSet());
|
|
|
|
-// List<SysDept> depts = deptService.listByIds(deptIds);
|
|
|
|
-// Map<Integer, String> deptMap = depts.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getName));
|
|
|
|
-//
|
|
|
|
-// Map<String, String> finalPackageUsersMap = packageUsersMap;
|
|
|
|
-// records.forEach(vo -> {
|
|
|
|
-// vo.setDeptName(deptMap.getOrDefault(vo.getDeptId(), ""));
|
|
|
|
-// vo.setTaskUsers(finalPackageUsersMap.getOrDefault(vo.getScorePackageId(), ""));
|
|
|
|
-// vo.setInvoiceStatusStr(vo.getInvoiceStatus().getDescription());
|
|
|
|
-// });
|
|
|
|
-//
|
|
|
|
-// return relationVOIPage;
|
|
|
|
-// }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 企业-开票管理列表
|
|
|
|
+ *
|
|
|
|
+ * @param toScorePackagePage 分页参数
|
|
|
|
+ * @return 分页结果
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public IPage<SysDeptInvoiceRelationVO> pageInvoiceForDept(Page<SysDeptInvoiceRelationVO> page, SysDeptInvoiceRequest.ToScorePackagePage toScorePackagePage) {
|
|
|
|
+
|
|
|
|
+ Integer deptId = SecurityUtils.getUser().getDeptId();
|
|
|
|
+
|
|
|
|
+ Set<Integer> queryDeptIds = new HashSet<>();
|
|
|
|
+ queryDeptIds.add(deptId);
|
|
|
|
+
|
|
|
|
+ // 查询园区关联的企业
|
|
|
|
+ List<SysDeptRelation> deptRelations = deptRelationService.list(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
|
|
+ .eq(SysDeptRelation::getAncestor, deptId)
|
|
|
|
+ .ne(SysDeptRelation::getDescendant, deptId));
|
|
|
|
+ if (CollUtil.isEmpty(deptRelations)) {
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Set<Integer> subDeptIds = deptRelations.stream().map(SysDeptRelation::getDescendant).collect(Collectors.toSet());
|
|
|
|
+ queryDeptIds.addAll(subDeptIds);
|
|
|
|
+ // 查询下级企业的信息
|
|
|
|
+ List<SysDeptRelation> subRelations = deptRelationService.list(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
|
|
+ .in(SysDeptRelation::getAncestor, subDeptIds));
|
|
|
|
+ if (CollUtil.isNotEmpty(subRelations)) {
|
|
|
|
+ Set<Integer> sub1DeptIds = subRelations.stream().map(SysDeptRelation::getDescendant).collect(Collectors.toSet());
|
|
|
|
+ queryDeptIds.addAll(sub1DeptIds);
|
|
|
|
+ // 查询下下级企业的信息
|
|
|
|
+ List<SysDeptRelation> sub2Relations = deptRelationService.list(Wrappers.<SysDeptRelation>lambdaQuery()
|
|
|
|
+ .in(SysDeptRelation::getAncestor, sub1DeptIds));
|
|
|
|
+ if (CollUtil.isNotEmpty(sub2Relations)) {
|
|
|
|
+ Set<Integer> sub2DeptIds = sub2Relations.stream().map(SysDeptRelation::getDescendant).collect(Collectors.toSet());
|
|
|
|
+ queryDeptIds.addAll(sub2DeptIds);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 企业名称查询过滤
|
|
|
|
+ if (StrUtil.isNotEmpty(toScorePackagePage.getDeptName())) {
|
|
|
|
+ List<SysDept> queryLikeDepts = deptService.list(Wrappers.<SysDept>lambdaQuery()
|
|
|
|
+ .like(SysDept::getName, toScorePackagePage.getDeptName()));
|
|
|
|
+ if (CollUtil.isEmpty(queryLikeDepts)) {
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+ Set<Integer> likeDeptIds = queryLikeDepts.stream().map(SysDept::getDeptId).collect(Collectors.toSet());
|
|
|
|
+ queryDeptIds.retainAll(likeDeptIds);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ IPage<SysDeptInvoiceRelationVO> relationVOIPage =
|
|
|
|
+ deptInvoiceRelationMapper.pageInvoiceScorePacakgeRelation(new Page<>(page.getCurrent(), page.getSize()), toScorePackagePage, queryDeptIds);
|
|
|
|
+
|
|
|
|
+ List<SysDeptInvoiceRelationVO> records = relationVOIPage.getRecords();
|
|
|
|
+ if (CollUtil.isEmpty(records)) {
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 积分包接单用户map
|
|
|
|
+ Map<String, String> packageUsersMap = new HashMap<>();
|
|
|
|
+ // 查领包记录
|
|
|
|
+ Set<String> packageIds = records.stream().map(SysDeptInvoiceRelationVO::getScorePackageId).collect(Collectors.toSet());
|
|
|
|
+ List<WmScorePackageStatus> scorePackageStatusList = scorePackageStatusMapper.selectList(Wrappers.<WmScorePackageStatus>lambdaQuery()
|
|
|
|
+ .in(WmScorePackageStatus::getPackageId, packageIds)
|
|
|
|
+ .eq(WmScorePackageStatus::getStatus, PackageStatusEnum.APPROVED.val()));
|
|
|
|
+ if (CollUtil.isNotEmpty(scorePackageStatusList)) {
|
|
|
|
+ // 查询领包记录的所有用户
|
|
|
|
+ Set<String> statusUserIds = scorePackageStatusList.stream().map(WmScorePackageStatus::getUserId).collect(Collectors.toSet());
|
|
|
|
+ List<SysUser> statusUsers = userService.listByIds(statusUserIds);
|
|
|
|
+ // 转为map(key-积分包id,value-领包用户逗号分隔)
|
|
|
|
+ Map<Integer, String> statusUserMap = statusUsers.stream().collect(Collectors.toMap(SysUser::getUserId, SysUser::getRealname));
|
|
|
|
+ packageUsersMap = scorePackageStatusList.stream()
|
|
|
|
+ .collect(Collectors.groupingBy(WmScorePackageStatus::getPackageId,
|
|
|
|
+ Collectors.mapping(wmScorePackageStatus ->
|
|
|
|
+ statusUserMap.getOrDefault(Integer.parseInt(wmScorePackageStatus.getUserId()), ""), Collectors.joining(","))));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 查询积分包涉及的企业
|
|
|
|
+ Set<Integer> deptIds = records.stream().map(SysDeptInvoiceRelationVO::getDeptId).collect(Collectors.toSet());
|
|
|
|
+ List<SysDept> depts = deptService.listByIds(deptIds);
|
|
|
|
+ Map<Integer, String> deptMap = depts.stream().collect(Collectors.toMap(SysDept::getDeptId, SysDept::getName));
|
|
|
|
+
|
|
|
|
+ Map<String, String> finalPackageUsersMap = packageUsersMap;
|
|
|
|
+ records.forEach(vo -> {
|
|
|
|
+ vo.setDeptName(deptMap.getOrDefault(vo.getDeptId(), ""));
|
|
|
|
+ vo.setTaskUsers(finalPackageUsersMap.getOrDefault(vo.getScorePackageId(), ""));
|
|
|
|
+ vo.setInvoiceStatusStr(vo.getInvoiceStatus().getDescription());
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ return relationVOIPage;
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 平台财务管理-开票列表
|
|
* 平台财务管理-开票列表
|
|
@@ -227,58 +222,58 @@ public class SysDeptInvoiceServiceImpl extends ServiceImpl<SysDeptInvoiceMapper,
|
|
return page;
|
|
return page;
|
|
}
|
|
}
|
|
|
|
|
|
-// /**
|
|
|
|
-// * 园区-开票列表
|
|
|
|
-// *
|
|
|
|
-// * @param page 分页参数
|
|
|
|
-// * @param toInvoicePage 请求参数
|
|
|
|
-// * @return 响应结果
|
|
|
|
-// */
|
|
|
|
-// @Override
|
|
|
|
-// public IPage<SysDeptInvoiceVO> pageInvoiceRecordForPark(Page<SysDeptInvoiceVO> page, SysDeptInvoiceRequest.ToInvoicePage toInvoicePage) {
|
|
|
|
-// Integer deptId = SecurityUtils.getUser().getDeptId();
|
|
|
|
-//
|
|
|
|
-// LambdaQueryWrapper<SysDeptInvoice> queryWrapper = Wrappers.lambdaQuery();
|
|
|
|
-// queryWrapper.eq(SysDeptInvoice::getDelFlag, DelEnum.NOT_DEL.val());
|
|
|
|
-// queryWrapper.eq(SysDeptInvoice::getDeptId, deptId);
|
|
|
|
-// if (toInvoicePage.getApprovalStatus() != null) {
|
|
|
|
-// queryWrapper.eq(SysDeptInvoice::getApprovalStatus, toInvoicePage.getApprovalStatus());
|
|
|
|
-// }
|
|
|
|
-// if (toInvoicePage.getCreateTime() != null && toInvoicePage.getCreateTime().length == 2) {
|
|
|
|
-// queryWrapper.between(SysDeptInvoice::getCreateTime, toInvoicePage.getCreateTime()[0], toInvoicePage.getCreateTime()[1]);
|
|
|
|
-// }
|
|
|
|
-// if (StrUtil.isNotBlank(toInvoicePage.getDeptName())) {
|
|
|
|
-// List<SysDept> queryLikeDepts = deptService.list(Wrappers.<SysDept>lambdaQuery()
|
|
|
|
-// .like(SysDept::getName, toInvoicePage.getDeptName()));
|
|
|
|
-// if (CollUtil.isEmpty(queryLikeDepts)) {
|
|
|
|
-// return page;
|
|
|
|
-// }
|
|
|
|
-// Set<Integer> likeDeptIds = queryLikeDepts.stream().map(SysDept::getDeptId).collect(Collectors.toSet());
|
|
|
|
-// queryWrapper.in(SysDeptInvoice::getDeptId, likeDeptIds);
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// Page<SysDeptInvoice> invoicePage = this.page(new Page<>(page.getCurrent(), page.getSize()), queryWrapper);
|
|
|
|
-//
|
|
|
|
-// if (CollUtil.isEmpty(invoicePage.getRecords())) {
|
|
|
|
-// return page;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// // 查询发票列表涉及的企业
|
|
|
|
-// SysDept dept = deptService.getById(deptId);
|
|
|
|
-//
|
|
|
|
-// List<SysDeptInvoiceVO> voList = new ArrayList<>();
|
|
|
|
-// invoicePage.getRecords().forEach(sysDeptInvoice -> {
|
|
|
|
-// SysDeptInvoiceVO deptInvoiceVO = BeanUtil.copyProperties(sysDeptInvoice, SysDeptInvoiceVO.class);
|
|
|
|
-// deptInvoiceVO.setDeptName(dept.getName());
|
|
|
|
-// voList.add(deptInvoiceVO);
|
|
|
|
-// });
|
|
|
|
-//
|
|
|
|
-// page.setPages(invoicePage.getPages());
|
|
|
|
-// page.setTotal(invoicePage.getTotal());
|
|
|
|
-// page.setRecords(voList);
|
|
|
|
-//
|
|
|
|
-// return page;
|
|
|
|
-// }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 园区-开票列表
|
|
|
|
+ *
|
|
|
|
+ * @param page 分页参数
|
|
|
|
+ * @param toInvoicePage 请求参数
|
|
|
|
+ * @return 响应结果
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public IPage<SysDeptInvoiceVO> pageInvoiceRecord(Page<SysDeptInvoiceVO> page, SysDeptInvoiceRequest.ToInvoicePage toInvoicePage) {
|
|
|
|
+ Integer deptId = SecurityUtils.getUser().getDeptId();
|
|
|
|
+
|
|
|
|
+ LambdaQueryWrapper<SysDeptInvoice> queryWrapper = Wrappers.lambdaQuery();
|
|
|
|
+ queryWrapper.eq(SysDeptInvoice::getDelFlag, DelEnum.NOT_DEL.val());
|
|
|
|
+ queryWrapper.eq(SysDeptInvoice::getDeptId, deptId);
|
|
|
|
+ if (toInvoicePage.getApprovalStatus() != null) {
|
|
|
|
+ queryWrapper.eq(SysDeptInvoice::getApprovalStatus, toInvoicePage.getApprovalStatus());
|
|
|
|
+ }
|
|
|
|
+ if (toInvoicePage.getCreateTime() != null && toInvoicePage.getCreateTime().length == 2) {
|
|
|
|
+ queryWrapper.between(SysDeptInvoice::getCreateTime, toInvoicePage.getCreateTime()[0], toInvoicePage.getCreateTime()[1]);
|
|
|
|
+ }
|
|
|
|
+ if (StrUtil.isNotBlank(toInvoicePage.getDeptName())) {
|
|
|
|
+ List<SysDept> queryLikeDepts = deptService.list(Wrappers.<SysDept>lambdaQuery()
|
|
|
|
+ .like(SysDept::getName, toInvoicePage.getDeptName()));
|
|
|
|
+ if (CollUtil.isEmpty(queryLikeDepts)) {
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+ Set<Integer> likeDeptIds = queryLikeDepts.stream().map(SysDept::getDeptId).collect(Collectors.toSet());
|
|
|
|
+ queryWrapper.in(SysDeptInvoice::getDeptId, likeDeptIds);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Page<SysDeptInvoice> invoicePage = this.page(new Page<>(page.getCurrent(), page.getSize()), queryWrapper);
|
|
|
|
+
|
|
|
|
+ if (CollUtil.isEmpty(invoicePage.getRecords())) {
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 查询发票列表涉及的企业
|
|
|
|
+ SysDept dept = deptService.getById(deptId);
|
|
|
|
+
|
|
|
|
+ List<SysDeptInvoiceVO> voList = new ArrayList<>();
|
|
|
|
+ invoicePage.getRecords().forEach(sysDeptInvoice -> {
|
|
|
|
+ SysDeptInvoiceVO deptInvoiceVO = BeanUtil.copyProperties(sysDeptInvoice, SysDeptInvoiceVO.class);
|
|
|
|
+ deptInvoiceVO.setDeptName(dept.getName());
|
|
|
|
+ voList.add(deptInvoiceVO);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ page.setPages(invoicePage.getPages());
|
|
|
|
+ page.setTotal(invoicePage.getTotal());
|
|
|
|
+ page.setRecords(voList);
|
|
|
|
+
|
|
|
|
+ return page;
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 平台财务-关联积分包列表
|
|
* 平台财务-关联积分包列表
|
|
@@ -371,7 +366,6 @@ public class SysDeptInvoiceServiceImpl extends ServiceImpl<SysDeptInvoiceMapper,
|
|
if (CollUtil.isEmpty(queryDeptIds)) {
|
|
if (CollUtil.isEmpty(queryDeptIds)) {
|
|
return Collections.emptyList();
|
|
return Collections.emptyList();
|
|
}
|
|
}
|
|
- // TODO 企业包已完成/个人包结算成功 则可开票
|
|
|
|
|
|
|
|
return deptInvoiceRelationMapper.listInvoiceScorePacakgeRelation(toScorePackagePage, queryDeptIds);
|
|
return deptInvoiceRelationMapper.listInvoiceScorePacakgeRelation(toScorePackagePage, queryDeptIds);
|
|
}
|
|
}
|