فهرست منبع

科室损益计算

ljx 4 سال پیش
والد
کامیت
d4b66db2d3

+ 3 - 0
src/main/java/com/imed/costaccount/model/vo/AllocationQueryReportVO.java

@@ -36,6 +36,9 @@ public class AllocationQueryReportVO {
      * 责任中心名称
      */
     private String responsibilityName;
+    private String targetResponsibilityCode;
+
+    private String targetResponsibilityName;
     /**
      * 来源id
      */

+ 8 - 6
src/main/java/com/imed/costaccount/service/impl/CostDepartmentProfitServiceImpl.java

@@ -337,6 +337,7 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
                         String reportTopName = sheet.getRow(row).getCell(1).getStringCellValue();
                         BigDecimal amount = profitMap.get(reportTopName + "cost" + responsibilityTopName).getAmount();
                         writer.writeCellValue(j+2,row,amount);
+
                     }
                 }
                 row++;
@@ -402,9 +403,8 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
             // 查找在归集数据里面当前责任中心对应的这些会计科目的金额
             List<IncomeCollection> incomeCollectionList = list.stream().filter(income -> income.getResponsibilityCode().equals(i.getResponsibilityCode()) && accountList.contains(income.getAccountingCode())).collect(Collectors.toList());
             // 需要查询分摊后的表
-//            List<AllocationQueryReportVO> collect = allocationQueryReportVOList.stream().filter(m -> m.getResponsibilityCode().equals(i.getResponsibilityCode())).collect(Collectors.toList());
-//            List<AllocationQueryReportVO> collect1 = collect.stream().filter(m -> !Collections.disjoint(accountList, m.getAccountingCodes())).collect(Collectors.toList());
-            List<AllocationQueryReportVO> reportVOList = allocationQueryReportVOList.stream().filter(m -> m.getResponsibilityCode().equals(i.getResponsibilityCode()) && !Collections.disjoint(accountList, m.getAccountingCodes())).collect(Collectors.toList());
+            List<AllocationQueryReportVO> reportVOList = allocationQueryReportVOList.stream().filter(m -> m.getTargetResponsibilityCode().equals(i.getResponsibilityCode()) && accountList.contains(m.getAccountingCode())).collect(Collectors.toList());
+
             if (CollUtil.isNotEmpty(incomeCollectionList)) {
                 incomeCollectionList.forEach(m -> {
                     sum.updateAndGet(v -> v.add(m.getAmount()));
@@ -432,10 +432,12 @@ public class CostDepartmentProfitServiceImpl extends ServiceImpl<CostDepartmentP
         if (CollUtil.isNotEmpty(reportRelationList)) {
             // 找到对应的分摊层级的Id  但是分摊报表里面存的是分摊层级的序号
             List<Long> shareLevelIds = reportRelationList.stream().map(ReportRelation::getRelationCode).map(Long::valueOf).collect(Collectors.toList());
-            List<Integer> levelShortList = costShareLevelList.stream().filter(m -> shareLevelIds.contains(m.getId())).map(CostShareLevel::getLeverSort).collect(Collectors.toList());
-            if (CollUtil.isNotEmpty(levelShortList)) {
+//            List<Integer> levelShortList = costShareLevelList.stream()
+//                    .filter(m -> shareLevelIds.contains(m.getId()))
+//                    .map(CostShareLevel::getLeverSort).collect(Collectors.toList());
+            if (CollUtil.isNotEmpty(shareLevelIds)) {
                 // 查询报表里面是当前分摊层级的数据
-                List<Allocation> allocations = allocationList.stream().filter(m -> levelShortList.contains(m.getLevelSort()) && m.getTargetResponsibilityCode().equals(i.getResponsibilityCode())).collect(Collectors.toList());
+                List<Allocation> allocations = allocationList.stream().filter(m -> shareLevelIds.contains(m.getShareLevelId()) && m.getTargetResponsibilityCode().equals(i.getResponsibilityCode())).collect(Collectors.toList());
                 if (CollUtil.isNotEmpty(allocations)) {
 //                    allocations.forEach(m -> {
 //                        sum.updateAndGet(v -> v.add(m.getAmount()));

+ 3 - 3
src/main/java/com/imed/costaccount/web/ExcelController.java

@@ -460,7 +460,7 @@ public class ExcelController extends AbstractController{
     }
 
     /**
-     * 成本分摊参数导出模板
+     * 科室损益计算导出
      */
     @GetMapping("/getDepartmentProfit")
     @ApiOperation("科室损益计算导出")
@@ -472,13 +472,13 @@ public class ExcelController extends AbstractController{
         }
         Long hospId = user.getHospId();
         String uuid = UUID.randomUUID().toString();
-        String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid + ".xls";
+        String url = System.getProperty("java.io.tmpdir") + File.separator + uuid + File.separator + uuid  + ".xls";
         FileUtil.del(FileUtil.file(url));
         ExcelWriter writer = new ExcelWriter(url);
         Sheet sheet = writer.getSheet();
         costDepartmentProfitService.getDepartmentProfit(writer,sheet,date);
         response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
-        response.setHeader("Content-Disposition", "attachment;filename=" + uuid + ".xls");
+        response.setHeader("Content-Disposition", "attachment;filename=" + uuid  + ".xls");
         ServletOutputStream out = null;
         out = response.getOutputStream();
         writer.flush(out, true);