浏览代码

Merge branch 'master' of huangrui/CostAccount into dev

lijiaxi 4 年之前
父节点
当前提交
6be601e884

+ 3 - 3
src/main/java/com/imed/costaccount/service/impl/AccountingServiceImpl.java

@@ -41,8 +41,8 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
      * 获取会计科目列表按收入支出类型
      * 获取会计科目列表按收入支出类型
      *
      *
      * @param accountType  会计科目类型1.收入,2.支出
      * @param accountType  会计科目类型1.收入,2.支出
-     * @param user
-     * @param shareParamId
+     * @param user         当前用户
+     * @param shareParamId 分摊id
      * @return
      * @return
      */
      */
     @Override
     @Override
@@ -348,7 +348,7 @@ public class AccountingServiceImpl extends ServiceImpl<AccountingMapper, Account
      * @return {@link Accounting} 可能为空 需要调用者自行判断
      * @return {@link Accounting} 可能为空 需要调用者自行判断
      */
      */
     @Override
     @Override
-    public Accounting getByCode(String accountCode,Long hospId) {
+    public Accounting getByCode(String accountCode, Long hospId) {
         if (StrUtil.isEmpty(accountCode)) {
         if (StrUtil.isEmpty(accountCode)) {
             throw new CostException("参数异常,accountCode 不能为空");
             throw new CostException("参数异常,accountCode 不能为空");
         }
         }

+ 5 - 8
src/main/java/com/imed/costaccount/service/impl/AllocationServiceImpl.java

@@ -38,7 +38,8 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
     private String fileTempPath;
     private String fileTempPath;
 
 
     @Value("${file.serverUrl}")
     @Value("${file.serverUrl}")
-    private String FILE_PATH;    private final CostCostingGroupService costCostingGroupService;
+    private String FILE_PATH;
+    private final CostCostingGroupService costCostingGroupService;
     private final CostShareLevelService shareLevelService;
     private final CostShareLevelService shareLevelService;
     private final ResponsibilityService responsibilityService;
     private final ResponsibilityService responsibilityService;
     private final CostAccountShareService accountShareService;
     private final CostAccountShareService accountShareService;
@@ -74,8 +75,9 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
         List<CostCostingGroup> costingGroups = costCostingGroupService.getByYearAndDate(startDTO.getYear(), startDTO.getMonth(), hospId);
         List<CostCostingGroup> costingGroups = costCostingGroupService.getByYearAndDate(startDTO.getYear(), startDTO.getMonth(), hospId);
         // 没有重新导入
         // 没有重新导入
         if (costingGroups.isEmpty()) {
         if (costingGroups.isEmpty()) {
-            throw new CostException("本月分摊参数值数据未导入");
+            throw new CostException("本月分摊数据未导入");
         }
         }
+        // 导入数据按责任中心归类
         Map<String, List<CostCostingGroup>> responsibilityCodeMap = costingGroups.stream().collect(Collectors.groupingBy(CostCostingGroup::getResponsibilityCode));
         Map<String, List<CostCostingGroup>> responsibilityCodeMap = costingGroups.stream().collect(Collectors.groupingBy(CostCostingGroup::getResponsibilityCode));
         // 得到这个月导入的成本分摊参数值列表
         // 得到这个月导入的成本分摊参数值列表
         List<ShareParamValue> shareParamValues = shareParamValueService.getListByYearAndMonth(startDTO.getYear(), startDTO.getMonth(), hospId);
         List<ShareParamValue> shareParamValues = shareParamValueService.getListByYearAndMonth(startDTO.getYear(), startDTO.getMonth(), hospId);
@@ -93,7 +95,7 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
         List<Allocation> allocations = new LinkedList<>();
         List<Allocation> allocations = new LinkedList<>();
         // key  责任中心代码, value 分摊过来的钱
         // key  责任中心代码, value 分摊过来的钱
 //        Map<String, BigDecimal> costMap = new ConcurrentReaderHashMap();
 //        Map<String, BigDecimal> costMap = new ConcurrentReaderHashMap();
-        List<Allocation> costList = new ArrayList();
+        List<Allocation> costList = new ArrayList<>();
         for (CostShareLevelVO shareLevelVO : shareLevelVOs) {
         for (CostShareLevelVO shareLevelVO : shareLevelVOs) {
             // 分摊层级id
             // 分摊层级id
             Long levelId = shareLevelVO.getId();
             Long levelId = shareLevelVO.getId();
@@ -135,7 +137,6 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
                         continue;
                         continue;
                     }
                     }
                     // 计算本次分摊的钱
                     // 计算本次分摊的钱
-
                     BigDecimal totalAmount = this.getCostAmount(accountShare, calcType, responsibilityCodeMap, costList);
                     BigDecimal totalAmount = this.getCostAmount(accountShare, calcType, responsibilityCodeMap, costList);
                     if (totalAmount.equals(BigDecimal.ZERO)) {
                     if (totalAmount.equals(BigDecimal.ZERO)) {
                         continue;
                         continue;
@@ -293,10 +294,6 @@ public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocat
         List<Allocation> all = new ArrayList<>();
         List<Allocation> all = new ArrayList<>();
         if (!costList.isEmpty()) {
         if (!costList.isEmpty()) {
             all = costList.stream().filter(i -> i.getTargetResponsibilityCode().equals(responsibilityCode)).collect(Collectors.toList());
             all = costList.stream().filter(i -> i.getTargetResponsibilityCode().equals(responsibilityCode)).collect(Collectors.toList());
-//            Stream<Allocation> allocationStream = costList.stream().filter(i -> i.getTargetResponsibilityCode().equals(responsibilityCode));
-//            if (Objects.nonNull(allocationStream)) {
-//                all = allocationStream.collect(Collectors.toList());
-//            }
         }
         }
         if (calcType == 0) {
         if (calcType == 0) {
             costAmount = costingGroups.stream().map(CostCostingGroup::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
             costAmount = costingGroups.stream().map(CostCostingGroup::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add);

+ 1 - 0
src/main/java/com/imed/costaccount/service/impl/IncomeCollectionServiceImpl.java

@@ -70,6 +70,7 @@ public class IncomeCollectionServiceImpl
                     new LambdaQueryWrapper<IncomeCollection>().select(IncomeCollection::getId)
                     new LambdaQueryWrapper<IncomeCollection>().select(IncomeCollection::getId)
                             .eq(IncomeCollection::getYear, i.getYear())
                             .eq(IncomeCollection::getYear, i.getYear())
                             .eq(IncomeCollection::getMonth, i.getMonth())
                             .eq(IncomeCollection::getMonth, i.getMonth())
+                            .eq(IncomeCollection::getHospId, hospId)
                             .last(LIMIT)
                             .last(LIMIT)
             );
             );
             if (Objects.isNull(one)) {
             if (Objects.isNull(one)) {