From 1fc203f758ace853f4bfa900c422c2f741d09e79 Mon Sep 17 00:00:00 2001
From: yanghb <yangbhwork@163.com>
Date: 星期二, 18 二月 2025 09:05:21 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 land-system/src/main/java/com/zzg/system/service/state/impl/StateHouseholdOwnerServiceImpl.java |   66 +++++++++++++++++++++++++++-----
 1 files changed, 55 insertions(+), 11 deletions(-)

diff --git a/land-system/src/main/java/com/zzg/system/service/state/impl/StateHouseholdOwnerServiceImpl.java b/land-system/src/main/java/com/zzg/system/service/state/impl/StateHouseholdOwnerServiceImpl.java
index fe9ef89..f6adebf 100644
--- a/land-system/src/main/java/com/zzg/system/service/state/impl/StateHouseholdOwnerServiceImpl.java
+++ b/land-system/src/main/java/com/zzg/system/service/state/impl/StateHouseholdOwnerServiceImpl.java
@@ -2,7 +2,6 @@
 
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageInfo;
@@ -11,12 +10,21 @@
 import com.zzg.common.core.domain.entity.state.StateProjectCompensateStandard;
 import com.zzg.common.core.domain.entity.state.StateProjectCompensation;
 import com.zzg.common.core.domain.entity.system.SysDictData;
-import com.zzg.common.enums.*;
+import com.zzg.common.enums.CompensateTypeEnum;
+import com.zzg.common.enums.CompensationCategoryEnum;
+import com.zzg.common.enums.DeleteFlagEnum;
+import com.zzg.common.enums.HouseOwnerTyeEnum;
+import com.zzg.common.enums.HouseUsingTypeEnum;
 import com.zzg.common.exception.GlobalException;
 import com.zzg.common.utils.RoundingUtil;
 import com.zzg.common.utils.StringUtils;
 import com.zzg.system.convert.StateProjectConvert;
-import com.zzg.system.domain.bo.*;
+import com.zzg.system.domain.bo.AwardBO;
+import com.zzg.system.domain.bo.CalculateCompensationBO;
+import com.zzg.system.domain.bo.HomeCompensationBO;
+import com.zzg.system.domain.bo.PolicyCompensationBO;
+import com.zzg.system.domain.bo.PolicySubsidyBO;
+import com.zzg.system.domain.bo.PolicySupplementBO;
 import com.zzg.system.domain.vo.CalculateCompensationVO;
 import com.zzg.system.domain.vo.OtherCompensationBO;
 import com.zzg.system.domain.vo.StateHouseholdOwnerVO;
@@ -30,7 +38,12 @@
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -88,17 +101,19 @@
     //如果不是区间 就直接计算
     @Override
     public CalculateCompensationVO calculateCompensation(CalculateCompensationBO calculateCompensationBO) {
-
+        //获取对应房产信息
         StateHousehold household = stateHouseholdService.getById(calculateCompensationBO.getStateHouseholdId());
         if (Objects.isNull(household)) {
             throw new GlobalException("未找到对应的房产");
         }
 
         String stateProjectId = household.getStateProjectId();
+        //获取项目补偿标准信息
         StateProjectCompensation compensation = stateProjectCompensationService.getById(stateProjectId);
         if (Objects.isNull(compensation)) {
             throw new GlobalException("项目没有设置标准");
         }
+        //通过标准类型名称查询对应的标准信息
         List<String> compensationNameList = new ArrayList<>();
         compensationNameList.add(compensation.getPolicyCompensationType());
         compensationNameList.add(compensation.getPolicySubsidy());
@@ -110,10 +125,13 @@
             throw new GlobalException("未找到开启的标准");
         }
         enableCompensateStandard = enableCompensateStandard.stream().filter(e -> Objects.nonNull(e.getSubType())).collect(Collectors.toList());
-        Map<Integer, Map<Integer, List<StateProjectCompensateStandard>>> enableCompensateStandardMap = enableCompensateStandard.stream().collect(Collectors.groupingBy(StateProjectCompensateStandard::getCompensateType, Collectors.groupingBy(StateProjectCompensateStandard::getCategory)));
+        //根据类型分组后再根据子类型进行一次分组
+        Map<Integer, Map<Integer, List<StateProjectCompensateStandard>>> enableCompensateStandardMap = enableCompensateStandard.stream()
+                .collect(Collectors.groupingBy(StateProjectCompensateStandard::getCompensateType, Collectors.groupingBy(StateProjectCompensateStandard::getCategory)));
 
         //征收房屋补偿费
         Double homeAmount = null;
+        // 从数据库查询的房产的预估价格附加信息不为空且calculateCompensationBO任意一个字段为空,则从数据库中房产的附加信息中获取
         if (org.apache.commons.lang3.StringUtils.isNotBlank(household.getAppendData()) && !areAllCompensationFieldsNotNull(calculateCompensationBO)) {
             calculateCompensationBO = JSON.parseObject(household.getAppendData(), CalculateCompensationBO.class);
         }
@@ -121,7 +139,7 @@
         Integer houseUsingType = household.getHouseUsingType();
 
         HomeCompensationBO homeCompensationBO = calculateCompensationBO.getHomeCompensationBO();
-
+        // 货币补偿
         if (Objects.nonNull(homeCompensationBO) && CompensationCategoryEnum.MONEY_COMPENSATION_1.getCode() == homeCompensationBO.getHomeCompensationType()) {
             Map<Integer, List<StateProjectCompensateStandard>> integerListMap = enableCompensateStandardMap.get(CompensateTypeEnum.HOUSE_ACQUISITION_COMPENSATION_FEE.getCode());
             if (!CollectionUtils.isEmpty(integerListMap)) {
@@ -162,12 +180,15 @@
                     }
                 }
             }
+            //产权置换
         } else if (Objects.nonNull(homeCompensationBO)) {
             Map<Integer, List<StateProjectCompensateStandard>> integerListMap = enableCompensateStandardMap.get(CompensateTypeEnum.HOUSE_ACQUISITION_COMPENSATION_FEE.getCode());
             if (!CollectionUtils.isEmpty(integerListMap)) {
+                //产权置换标准
                 List<StateProjectCompensateStandard> stateProjectCompensateStandards = integerListMap.get(CompensationCategoryEnum.PROPERTY_SWAP.getCode());
                 if (!CollectionUtils.isEmpty(stateProjectCompensateStandards)) {
                     StateProjectCompensateStandard stateProjectCompensateStandard;
+                    //根据房屋类型获取标准
                     if (HouseUsingTypeEnum.PERSONAL_HOUSE.getValue().equals(houseUsingType)) {
                         stateProjectCompensateStandard = stateProjectCompensateStandards.stream().filter(e -> e.getSpecification().equals("住宅")).findFirst().get();
                     } else {
@@ -215,6 +236,7 @@
             compensationVO.getHomeCompensationBO().setTotalAmount(homeAmount);
         }
         //政策性补偿费
+        //补偿费总金额
         Double policyAmount = 0.0;
         PolicyCompensationBO policyCompensationBO = calculateCompensationBO.getPolicyCompensationBO();
         Map<Integer, List<StateProjectCompensateStandard>> integerListMap = enableCompensateStandardMap.get(CompensateTypeEnum.POLICY_COMPENSATION_FEE.getCode());
@@ -227,6 +249,7 @@
                 } else {
                     stateProjectCompensateStandard = stateProjectCompensateStandards.stream().filter(e -> e.getSpecification().equals("非住宅")).findFirst().get();
                 }
+                //电话移机费用
                 Double telephoneRelocationAmount = 0.0;
                 if (!checkCompensateStandard(stateProjectCompensateStandard)) {
                     // Skip further calculations or set default values to avoid computation
@@ -255,10 +278,11 @@
                     ;
                 }
             }
-
+            // 有线电视迁装
             if (Objects.nonNull(policyCompensationBO.getCableTVRelocation()) && Objects.nonNull(integerListMap.get(CompensationCategoryEnum.CABLE_TV_RELOCATION.getCode()))) {
                 List<StateProjectCompensateStandard> stateProjectCompensateStandards = integerListMap.get(CompensationCategoryEnum.CABLE_TV_RELOCATION.getCode());
                 StateProjectCompensateStandard stateProjectCompensateStandard = stateProjectCompensateStandards.stream().findFirst().get();
+                // 有线电视迁装金额
                 Double cableTVRelocationAmount = 0.0;
                 if (!checkCompensateStandard(stateProjectCompensateStandard)) {
                     // Skip further calculations or set default values to avoid computation
@@ -287,9 +311,11 @@
                     ;
                 }
             }
+            // 宽带迁装
             if (Objects.nonNull(policyCompensationBO.getBroadbandRelocation()) && Objects.nonNull(integerListMap.get(CompensationCategoryEnum.BROADBAND_RELOCATION.getCode()))) {
                 List<StateProjectCompensateStandard> stateProjectCompensateStandards = integerListMap.get(CompensationCategoryEnum.BROADBAND_RELOCATION.getCode());
                 StateProjectCompensateStandard stateProjectCompensateStandard = stateProjectCompensateStandards.stream().findFirst().get();
+                // 宽带迁装金额
                 Double broadbandRelocationAmount = 0.0;
                 if (!checkCompensateStandard(stateProjectCompensateStandard)) {
                     // Skip further calculations or set default values to avoid computation
@@ -318,10 +344,11 @@
                     ;
                 }
             }
-
+            // 空调移机
             if (Objects.nonNull(policyCompensationBO.getAirConditionerRelocation()) && Objects.nonNull(integerListMap.get(CompensationCategoryEnum.AIR_CONDITIONER_RELOCATION.getCode()))) {
                 List<StateProjectCompensateStandard> stateProjectCompensateStandards = integerListMap.get(CompensationCategoryEnum.AIR_CONDITIONER_RELOCATION.getCode());
                 StateProjectCompensateStandard stateProjectCompensateStandard = stateProjectCompensateStandards.stream().findFirst().get();
+                // 空调移机金额
                 Double airConditionerRelocationAmount = 0.0;
                 if (!checkCompensateStandard(stateProjectCompensateStandard)) {
                     // Skip further calculations or set default values to avoid computation
@@ -350,9 +377,11 @@
                     ;
                 }
             }
+            // 一户一表
             if (Objects.nonNull(policyCompensationBO.getIndividualMeterInstallation()) && Objects.nonNull(integerListMap.get(CompensationCategoryEnum.ONE_HOUSE_ONE_METER.getCode()))) {
                 List<StateProjectCompensateStandard> stateProjectCompensateStandards = integerListMap.get(CompensationCategoryEnum.ONE_HOUSE_ONE_METER.getCode());
                 StateProjectCompensateStandard stateProjectCompensateStandard = stateProjectCompensateStandards.stream().findFirst().get();
+                // 一户一表金额
                 Double individualMeterInstallationAmount = 0.0;
                 if (!checkCompensateStandard(stateProjectCompensateStandard)) {
                     // Skip further calculations or set default values to avoid computation
@@ -382,6 +411,7 @@
                     ;
                 }
             }
+            // 天然气初装
             if (Objects.nonNull(policyCompensationBO.getGasInitialInstallation()) && Objects.nonNull(integerListMap.get(CompensationCategoryEnum.GAS_INITIAL_INSTALLATION.getCode()))) {
                 List<StateProjectCompensateStandard> stateProjectCompensateStandards = integerListMap.get(CompensationCategoryEnum.GAS_INITIAL_INSTALLATION.getCode());
                 StateProjectCompensateStandard stateProjectCompensateStandard = stateProjectCompensateStandards.stream().findFirst().get();
@@ -416,13 +446,18 @@
         }
         compensationVO.getPolicyCompensationBO().calculateTotalAmount();
         //政策性补助费
+        // 住宅临时安置补助费
         Double policySubsidyAmount = null;
+        //非住宅停产,停业经济损失补偿费
         Double nonResidentialEconomicLossAllowanceAmount = null;
+        // 搬家补助费
         Double movingAllowanceAmount = null;
         PolicySubsidyBO policySubsidyBO = calculateCompensationBO.getPolicySubsidyBO();
+        //货币补偿
         if (Objects.nonNull(policySubsidyBO) && CompensationCategoryEnum.MONEY_COMPENSATION_1.getCode() == policySubsidyBO.getCompensationType()) {
             Map<Integer, List<StateProjectCompensateStandard>> policySubsidyMap = enableCompensateStandardMap.get(CompensateTypeEnum.POLICY_SUBSIDY_FEE.getCode());
             if (!CollectionUtils.isEmpty(policySubsidyMap)) {
+                // 住宅临时安置补助费
                 List<StateProjectCompensateStandard> stateProjectCompensateStandards = policySubsidyMap.get(CompensationCategoryEnum.TEMPORARY_HOUSING_ALLOWANCE.getCode());
                 if (!CollectionUtils.isEmpty(stateProjectCompensateStandards)) {
                     StateProjectCompensateStandard stateProjectCompensateStandard = stateProjectCompensateStandards.stream().findFirst().get();
@@ -454,6 +489,7 @@
                         }
                     }
                 }
+                // 非住宅停产、停业经济损失补助费
                 List<StateProjectCompensateStandard> nonResidentialEconomicLossAllowance = policySubsidyMap.get(CompensationCategoryEnum.NON_RESIDENTIAL_ECONOMIC_LOSS_ALLOWANCE.getCode());
                 if (!CollectionUtils.isEmpty(nonResidentialEconomicLossAllowance)) {
                     StateProjectCompensateStandard stateProjectCompensateStandard = nonResidentialEconomicLossAllowance.stream().findFirst().get();
@@ -480,6 +516,7 @@
                         }
                     }
                 }
+                // 搬家补助费
                 List<StateProjectCompensateStandard> movingAllowance = policySubsidyMap.get(CompensationCategoryEnum.MOVING_ALLOWANCE.getCode());
                 if (!CollectionUtils.isEmpty(movingAllowance)) {
                     StateProjectCompensateStandard stateProjectCompensateStandard = movingAllowance.stream().findFirst().get();
@@ -507,9 +544,10 @@
                     }
                 }
             }
-        } else if (Objects.nonNull(policySubsidyBO)) {
+        } else if (Objects.nonNull(policySubsidyBO)) { //产权置换
             Map<Integer, List<StateProjectCompensateStandard>> policySubsidyMap = enableCompensateStandardMap.get(CompensateTypeEnum.POLICY_SUBSIDY_FEE.getCode());
             if (!CollectionUtils.isEmpty(policySubsidyMap)) {
+                // 住宅临时安置补助费
                 List<StateProjectCompensateStandard> stateProjectCompensateStandards = policySubsidyMap.get(CompensationCategoryEnum.TEMPORARY_HOUSING_ALLOWANCE.getCode());
                 if (!CollectionUtils.isEmpty(stateProjectCompensateStandards)) {
                     StateProjectCompensateStandard stateProjectCompensateStandard = stateProjectCompensateStandards.stream().findFirst().get();
@@ -542,6 +580,7 @@
                         }
                     }
                 }
+                // 非住宅停产、停业经济损失补助费
                 List<StateProjectCompensateStandard> nonResidentialEconomicLossAllowance = policySubsidyMap.get(CompensationCategoryEnum.NON_RESIDENTIAL_ECONOMIC_LOSS_ALLOWANCE.getCode());
                 if (!CollectionUtils.isEmpty(nonResidentialEconomicLossAllowance)) {
                     StateProjectCompensateStandard stateProjectCompensateStandard = nonResidentialEconomicLossAllowance.stream().findFirst().get();
@@ -570,6 +609,7 @@
                         }
                     }
                 }
+                // 搬家补助费
                 List<StateProjectCompensateStandard> movingAllowance = policySubsidyMap.get(CompensationCategoryEnum.MOVING_ALLOWANCE.getCode());
                 if (!CollectionUtils.isEmpty(movingAllowance)) {
                     StateProjectCompensateStandard stateProjectCompensateStandard = movingAllowance.stream().findFirst().get();
@@ -602,7 +642,9 @@
         }
 
         //政策性补贴
+        //购房补贴
         Double propertyManagementSubsidyAmount = null;
+        //物管费补贴
         Double housingSubsidyAmount = null;
         PolicySupplementBO policySupplementBO = calculateCompensationBO.getPolicySupplementBO();
         if (Objects.isNull(calculateCompensationBO.getPolicySupplementBO())) {
@@ -612,6 +654,7 @@
         }
         Map<Integer, List<StateProjectCompensateStandard>> policyAllowanceMap = enableCompensateStandardMap.get(CompensateTypeEnum.POLICY_ALLOWANCE.getCode());
         if (!CollectionUtils.isEmpty(policyAllowanceMap)) {
+            // 物管费补贴
             if (Objects.nonNull(policyAllowanceMap.get(CompensationCategoryEnum.PROPERTY_MANAGEMENT_SUBSIDY.getCode()))) {
                 List<StateProjectCompensateStandard> stateProjectCompensateStandards = policyAllowanceMap.get(CompensationCategoryEnum.PROPERTY_MANAGEMENT_SUBSIDY.getCode());
                 StateProjectCompensateStandard stateProjectCompensateStandard;
@@ -656,6 +699,7 @@
                     compensationVO.getPolicySupplementBO().setPropertyManagementSubsidy(propertyManagementSubsidyAmount);
                 }
             }
+            // 购房补贴
             if (Objects.nonNull(policyAllowanceMap.get(CompensationCategoryEnum.HOUSE_PURCHASE_SUBSIDY.getCode()))) {
                 List<StateProjectCompensateStandard> stateProjectCompensateStandards = policyAllowanceMap.get(CompensationCategoryEnum.HOUSE_PURCHASE_SUBSIDY.getCode());
                 StateProjectCompensateStandard stateProjectCompensateStandard;
@@ -693,7 +737,7 @@
 
             }
         }
-
+        // 提前搬迁奖励
         Double earlyRelocationRewardAmount = null;
         AwardBO awardBO = compensationVO.getAwardBO();
         Map<Integer, List<StateProjectCompensateStandard>> earlyRelocationRewardMap = enableCompensateStandardMap.get(CompensateTypeEnum.EARLY_RELOCATION_REWARD.getCode());

--
Gitblit v1.7.1