Procházet zdrojové kódy

feat: 积分充值-开票接口调整

李学松 před 2 roky
rodič
revize
c12566f748

+ 1 - 1
db/v2.0/230628.sql

@@ -29,7 +29,7 @@ create table sys_dept_recharge_record
     relation_dept_id int                                      null comment '关联组织机构ID(关联操作对象)',
     relation_dept_id int                                      null comment '关联组织机构ID(关联操作对象)',
     change_score     int                                      not null comment '充值积分',
     change_score     int                                      not null comment '充值积分',
     change_amount    decimal(10, 2) default 0.00              not null comment '充值金额(元)',
     change_amount    decimal(10, 2) default 0.00              not null comment '充值金额(元)',
-    type             char(20)                                 not null comment '操作类型',
+    type             char(25)                                 not null comment '操作类型',
     current_score    int                                      not null comment '充值后积分余额',
     current_score    int                                      not null comment '充值后积分余额',
     current_balance  decimal(10, 2) default 0.00              not null comment '充值后积分余额(元)',
     current_balance  decimal(10, 2) default 0.00              not null comment '充值后积分余额(元)',
     package_id       int                                      null comment '积分包id',
     package_id       int                                      null comment '积分包id',

+ 24 - 24
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/recharge/controller/SysDeptInvoiceController.java

@@ -73,18 +73,18 @@ public class SysDeptInvoiceController {
         return R.ok(deptInvoiceService.toApprove(toApprove));
         return R.ok(deptInvoiceService.toApprove(toApprove));
     }
     }
 
 
-//    /**
-//     * 园区-开票管理列表
-//     *
-//     * @param page               分页参数
-//     * @param toScorePackagePage 请求参数
-//     * @return 响应结果
-//     */
-//    @GetMapping("/page-invoice-for-park")
-//    public R<IPage<SysDeptInvoiceRelationVO>> pageInvoiceForPark(Page<SysDeptInvoiceRelationVO> page, SysDeptInvoiceRequest.ToScorePackagePage toScorePackagePage) {
-//
-//        return R.ok(deptInvoiceService.pageInvoiceForPark(page, toScorePackagePage));
-//    }
+    /**
+     * 企业-开票管理列表
+     *
+     * @param page               分页参数
+     * @param toScorePackagePage 请求参数
+     * @return 响应结果
+     */
+    @GetMapping("/page-invoice-for-dept")
+    public R<IPage<SysDeptInvoiceRelationVO>> pageInvoiceForDept(Page<SysDeptInvoiceRelationVO> page, SysDeptInvoiceRequest.ToScorePackagePage toScorePackagePage) {
+
+        return R.ok(deptInvoiceService.pageInvoiceForDept(page, toScorePackagePage));
+    }
 
 
     /**
     /**
      * 平台财务管理-开票列表
      * 平台财务管理-开票列表
@@ -99,18 +99,18 @@ public class SysDeptInvoiceController {
         return R.ok(deptInvoiceService.pageInvoiceForAdmin(page, toInvoicePage));
         return R.ok(deptInvoiceService.pageInvoiceForAdmin(page, toInvoicePage));
     }
     }
 
 
-//    /**
-//     * 园区-开票列表
-//     *
-//     * @param page          分页参数
-//     * @param toInvoicePage 请求参数
-//     * @return 响应结果
-//     */
-//    @GetMapping("/page-invoice-record")
-//    public R<IPage<SysDeptInvoiceVO>> pageInvoiceRecordForPark(Page<SysDeptInvoiceVO> page, SysDeptInvoiceRequest.ToInvoicePage toInvoicePage) {
-//
-//        return R.ok(deptInvoiceService.pageInvoiceRecordForPark(page, toInvoicePage));
-//    }
+    /**
+     * 开票记录
+     *
+     * @param page          分页参数
+     * @param toInvoicePage 请求参数
+     * @return 响应结果
+     */
+    @GetMapping("/page-invoice-record")
+    public R<IPage<SysDeptInvoiceVO>> pageInvoiceRecord(Page<SysDeptInvoiceVO> page, SysDeptInvoiceRequest.ToInvoicePage toInvoicePage) {
+
+        return R.ok(deptInvoiceService.pageInvoiceRecord(page, toInvoicePage));
+    }
 
 
     /**
     /**
      * 平台财务-关联积分包列表
      * 平台财务-关联积分包列表

+ 15 - 15
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/recharge/service/SysDeptInvoiceService.java

@@ -17,13 +17,13 @@ import java.util.List;
 */
 */
 public interface SysDeptInvoiceService extends IService<SysDeptInvoice> {
 public interface SysDeptInvoiceService extends IService<SysDeptInvoice> {
 
 
-//    /**
-//     * 园区-开票管理列表
-//     *
-//     * @param toScorePackagePage 分页参数
-//     * @return 分页结果
-//     */
-//    IPage<SysDeptInvoiceRelationVO> pageInvoiceForPark(Page<SysDeptInvoiceRelationVO> page, SysDeptInvoiceRequest.ToScorePackagePage toScorePackagePage);
+    /**
+     * 企业-开票管理列表
+     *
+     * @param toScorePackagePage 分页参数
+     * @return 分页结果
+     */
+    IPage<SysDeptInvoiceRelationVO> pageInvoiceForDept(Page<SysDeptInvoiceRelationVO> page, SysDeptInvoiceRequest.ToScorePackagePage toScorePackagePage);
 
 
     /**
     /**
      * 平台财务管理-开票列表
      * 平台财务管理-开票列表
@@ -34,14 +34,14 @@ public interface SysDeptInvoiceService extends IService<SysDeptInvoice> {
      */
      */
     IPage<SysDeptInvoiceVO> pageInvoiceForAdmin(Page<SysDeptInvoiceVO> page, SysDeptInvoiceRequest.ToInvoicePage toInvoicePage);
     IPage<SysDeptInvoiceVO> pageInvoiceForAdmin(Page<SysDeptInvoiceVO> page, SysDeptInvoiceRequest.ToInvoicePage toInvoicePage);
 
 
-//    /**
-//     * 园区-开票列表
-//     *
-//     * @param page 分页参数
-//     * @param toInvoicePage 请求参数
-//     * @return 响应结果
-//     */
-//    IPage<SysDeptInvoiceVO> pageInvoiceRecordForPark(Page<SysDeptInvoiceVO> page, SysDeptInvoiceRequest.ToInvoicePage toInvoicePage);
+    /**
+     * 园区-开票列表
+     *
+     * @param page 分页参数
+     * @param toInvoicePage 请求参数
+     * @return 响应结果
+     */
+    IPage<SysDeptInvoiceVO> pageInvoiceRecord(Page<SysDeptInvoiceVO> page, SysDeptInvoiceRequest.ToInvoicePage toInvoicePage);
 
 
     /**
     /**
      * 平台财务-关联积分包列表
      * 平台财务-关联积分包列表

+ 143 - 149
hnqz-upms/hnqz-upms-biz/src/main/java/com/qunzhixinxi/hnqz/admin/recharge/service/impl/SysDeptInvoiceServiceImpl.java

@@ -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);
     }
     }

+ 6 - 3
hnqz-upms/hnqz-upms-biz/src/main/resources/mapper/SysDeptInvoiceRelationMapper.xml

@@ -23,7 +23,8 @@
         FROM wm_score_package p
         FROM wm_score_package p
         LEFT JOIN sys_dept_invoice_relation r on r.package_id = p.id AND r.del_flag = '0'
         LEFT JOIN sys_dept_invoice_relation r on r.package_id = p.id AND r.del_flag = '0'
         <where>
         <where>
-            AND p.package_type1 = '1' AND p.package_type2 = '1' AND p.score_package_status = '4' AND p.typeid = '4'
+            AND (p.package_type1 = '1' AND p.package_type2 = '1' AND p.score_package_status = '1' AND p.typeid in ('3', '4')
+                OR (p.old_package = '0' AND p.package_finish_status = '1' AND p.typeid not in ('3', '4')))
             AND p.send_package_dept_id IN
             AND p.send_package_dept_id IN
             <foreach collection="deptIdList" item="deptId" index="idx" separator="," open="(" close=")">
             <foreach collection="deptIdList" item="deptId" index="idx" separator="," open="(" close=")">
                 #{deptId}
                 #{deptId}
@@ -47,7 +48,8 @@
         FROM wm_score_package p
         FROM wm_score_package p
         LEFT JOIN sys_dept_invoice_relation r on r.package_id = p.id AND r.del_flag = '0'
         LEFT JOIN sys_dept_invoice_relation r on r.package_id = p.id AND r.del_flag = '0'
         <where>
         <where>
-            AND p.package_type1 = '1' AND p.package_type2 = '1' AND p.score_package_status = '4' AND p.typeid = '4'
+            AND (p.package_type1 = '1' AND p.package_type2 = '1' AND p.score_package_status = '1' AND p.typeid in ('3', '4')
+                OR (p.old_package = '0' AND p.package_finish_status = '1' AND p.typeid not in ('3', '4')))
             AND p.send_package_dept_id IN
             AND p.send_package_dept_id IN
             <foreach collection="deptIdList" item="deptId" index="idx" separator="," open="(" close=")">
             <foreach collection="deptIdList" item="deptId" index="idx" separator="," open="(" close=")">
                 #{deptId}
                 #{deptId}
@@ -71,7 +73,8 @@
         FROM wm_score_package p
         FROM wm_score_package p
         LEFT JOIN sys_dept_invoice_relation r on r.package_id = p.id
         LEFT JOIN sys_dept_invoice_relation r on r.package_id = p.id
         <where>
         <where>
-            AND p.package_type1 = '1' AND p.package_type2 = '1' AND p.score_package_status = '4' AND p.typeid = '4'
+            AND (p.package_type1 = '1' AND p.package_type2 = '1' AND p.score_package_status = '1' AND p.typeid in ('3', '4')
+                OR (p.old_package = '0' AND p.package_finish_status = '1' AND p.typeid not in ('3', '4')))
             AND r.del_flag = '0'
             AND r.del_flag = '0'
             AND r.invoice_id = #{invoiceId}
             AND r.invoice_id = #{invoiceId}
         </where>
         </where>