From 93fec20f3cf9d7801eeaa10acef4687ed110d435 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期一, 20 一月 2025 17:59:09 +0800
Subject: [PATCH] 添加接口备注

---
 land-system/src/main/java/com/zzg/system/service/state/impl/StateSettlementImpl.java |   76 ++++++++++++++++++++++++++++----------
 1 files changed, 56 insertions(+), 20 deletions(-)

diff --git a/land-system/src/main/java/com/zzg/system/service/state/impl/StateSettlementImpl.java b/land-system/src/main/java/com/zzg/system/service/state/impl/StateSettlementImpl.java
index 9c3970d..df3742e 100644
--- a/land-system/src/main/java/com/zzg/system/service/state/impl/StateSettlementImpl.java
+++ b/land-system/src/main/java/com/zzg/system/service/state/impl/StateSettlementImpl.java
@@ -120,10 +120,15 @@
         return result;
     }
 
-
+    /**
+     * 安置情况页面数据
+     * @param settlementBO
+     * @return
+     */
     @Override
     public PageInfo<HouseholdVO> listSettleData(SettlementBO settlementBO) {
         PageUtils.startPage();
+        //根据查询条件查询房产数据
         List<HouseholdVO> householdVOList = settlementMapper.listSettleData(settlementBO);
         if (CollectionUtils.isEmpty(householdVOList)) {
             return new PageInfo<>();
@@ -138,14 +143,14 @@
                 .filter(Objects::nonNull) // 过滤掉 houseStateId 为 null 的情况
                 .distinct() // 去重
                 .collect(Collectors.toList());
-
+        //根据房产id查询所有权利人信息
         LambdaQueryWrapper<StateHouseholdOwner> householdOwnerLambdaQueryWrapper = new LambdaQueryWrapper<>();
         householdOwnerLambdaQueryWrapper.in(StateHouseholdOwner::getStateHouseholdId, houseIdList);
         if (!com.zzg.common.utils.StringUtils.isEmpty(settlementBO.getOwnerName())) {
             householdOwnerLambdaQueryWrapper.like(StateHouseholdOwner::getOwnerName, settlementBO.getOwnerName());
         }
         List<StateHouseholdOwner> stateHouseholdOwners = stateHouseholdOwnerService.list(householdOwnerLambdaQueryWrapper);
-
+        //根据房产id 将权利人分组
         Map<String, List<StateHouseholdOwner>> ownerMap = stateHouseholdOwners.stream().collect(Collectors.groupingBy(StateHouseholdOwner::getStateHouseholdId));
         if (!com.zzg.common.utils.StringUtils.isEmpty(settlementBO.getOwnerName())) {
             householdVOList = householdVOList.stream().filter(data -> ownerMap.containsKey(data.getId())).collect(Collectors.toList());
@@ -221,7 +226,7 @@
         stateSettlementLambdaQueryWrapper.in(StateSettlement::getStateHouseholdId, houseIdList);
         stateSettlementLambdaQueryWrapper.eq(StateSettlement::getDelFlag, DeleteFlagEnum.NOT_DELETED.getKey());
         stateSettlementLambdaQueryWrapper.isNotNull(StateSettlement::getAuditStatus);
-
+        //根据条件查询安置情况
         List<StateSettlement> stateSettlementList = this.list(stateSettlementLambdaQueryWrapper);
 
         Map<String, String> departmentMap = stateSettlementList.stream().collect(Collectors.toMap(StateSettlement::getStateHouseholdId, StateSettlement::getSettleDepartment));
@@ -234,19 +239,23 @@
 
         //根据入参区分是否安置
         if (Objects.nonNull(settlementBO.getIsSettled())) {
+            //未安置
             if (Objects.equals(settlementBO.getIsSettled(), SettledProcessEnum.NOT_SETTLE.getValue())) {
                 List<String> settledHouseId;
                 if (CollectionUtils.isNotEmpty(stateSettlementList)) {
                     List<String> settledHouseIdList = stateSettlementList.stream().map(StateSettlement::getStateHouseholdId).collect(Collectors.toList());
+                    //过滤未安置的房产id
                     settledHouseId = houseIdList.stream().filter(e -> !settledHouseIdList.contains(e)).collect(Collectors.toList());
                     List<String> finalSettledHouseId = settledHouseId;
                     voArrayList.addAll(householdVOS.stream().filter(data -> finalSettledHouseId.contains(data.getId())).collect(Collectors.toList()));
                 } else {
                     voArrayList.addAll(householdVOS);
                 }
-
+            //已安置
             } else {
+                //已安置房产id列表
                 List<String> settledHouseId = stateSettlementList.stream().map(StateSettlement::getStateHouseholdId).collect(Collectors.toList());
+                //过滤已安置的房产
                 List<HouseholdVO> list = householdVOS.stream().filter(data -> settledHouseId.contains(data.getId())).collect(Collectors.toList());
                 //设置安置时间 安置状态 安置批次
                 Map<String, StateSettlement> settlementMap = stateSettlementList
@@ -312,6 +321,7 @@
         SettlementDetailPageVO pageVO = new SettlementDetailPageVO();
 
         PageUtils.startPage();
+        //分页查询安置情况
         List<SettlementDetailVO> settlementDetailVOS = settlementMapper.listSettleDetail(settlementDetailBO);
         if (CollectionUtils.isEmpty(settlementDetailVOS)) {
             pageVO.setPageData(new PageInfo<>());
@@ -321,6 +331,7 @@
         PageInfo<SettlementDetailVO> settlementDetailVOPageInfo = new PageInfo<>(settlementDetailVOS);
         List<SettlementDetailVO> detailVOS = new ArrayList<>();
         //拼接名字
+        //根据房产id进行分组
         Map<String, SettlementDetailVO> householdMap = settlementDetailVOS.stream().filter(Objects::nonNull).collect(Collectors.toMap(StateSettlement::getStateHouseholdId, Function.identity()));
         for (Map.Entry<String, SettlementDetailVO> entry : householdMap.entrySet()) {
             String householdId = entry.getKey();
@@ -360,7 +371,7 @@
                 stateHouseholds.stream().map(StateHousehold::getId).collect(Collectors.toList()));
         stateSettlementLambdaQueryWrapper.isNull(StateSettlement::getAuditStatus);
         stateSettlementLambdaQueryWrapper.orderByDesc(StateSettlement::getCreateTime);
-
+        //查询安置情况
         List<StateSettlement> stateSettlementList = this.list(stateSettlementLambdaQueryWrapper);
         if (CollectionUtils.isNotEmpty(stateSettlementList)) {
             String latestHouseId = stateSettlementList.get(0).getStateHouseholdId();
@@ -434,16 +445,21 @@
         }
     }
 
-
+    /**
+     * 外层项目实施数据
+     * @param projectId
+     * @return
+     */
     @Override
     public SettlementSumVO sumSettleData(String projectId) {
         LambdaQueryWrapper<StateProject> stateProjectQueryWrapper = new LambdaQueryWrapper<>();
         stateProjectQueryWrapper.eq(StateProject::getId, projectId);
+        //查询项目
         StateProject stateProject = stateProjectMapper.selectOne(stateProjectQueryWrapper);
         if (Objects.isNull(stateProject)) {
             return new SettlementSumVO();
         }
-
+        //查询房产
         LambdaQueryWrapper<StateHousehold> stateHouseholdQueryWrapper = new LambdaQueryWrapper<>();
         stateHouseholdQueryWrapper.eq(StateHousehold::getStateProjectId, projectId);
         List<StateHousehold> stateHouseholds = stateHouseholdMapper.selectList(stateHouseholdQueryWrapper);
@@ -455,7 +471,7 @@
         SettlementSumVO settlementSumVO = new SettlementSumVO();
         //查询房产的协议/安置情况
         List<String> householdIds = stateHouseholds.stream().map(StateHousehold::getId).distinct().collect(Collectors.toList());
-
+        //查询结算
         LambdaQueryWrapper<StateSettlement> stateSettlementQueryWrapper = new LambdaQueryWrapper<>();
         stateSettlementQueryWrapper.in(StateSettlement::getStateHouseholdId, householdIds);
         stateSettlementQueryWrapper.isNotNull(StateSettlement::getAuditStatus);
@@ -549,7 +565,7 @@
             return new PageInfo<>();
         }
         PageInfo<StateExecutionDetailVO> pageInfo = new PageInfo<>(list);
-
+        //返回的结果列表
         List<StateExecutionDetailVO> result = new ArrayList<>();
 
         List<StateExecutionDetailVO> executionDetailVOS = list.stream().filter(Objects::nonNull).collect(Collectors.toList());
@@ -630,7 +646,7 @@
             return new ArrayList<>();
         }
         List<StateExecutionDetailVO> result = new ArrayList<>();
-
+        //过滤空值
         List<StateExecutionDetailVO> executionDetailVOS = list.stream().filter(Objects::nonNull).collect(Collectors.toList());
 
         List<String> houseIdList = executionDetailVOS.stream()
@@ -644,6 +660,7 @@
         if (!com.zzg.common.utils.StringUtils.isEmpty(executionB.getOwnerName())) {
             householdOwnerLambdaQueryWrapper.like(StateHouseholdOwner::getOwnerName, executionB.getOwnerName());
         }
+        //查询权利人
         List<StateHouseholdOwner> stateHouseholdOwners = stateHouseholdOwnerService.list(householdOwnerLambdaQueryWrapper);
 
         Map<String, List<StateHouseholdOwner>> ownerMap = stateHouseholdOwners.stream().collect(Collectors.groupingBy(StateHouseholdOwner::getStateHouseholdId));
@@ -666,6 +683,7 @@
         LambdaQueryWrapper<StateAgreement> agreementQueryWrapper = new LambdaQueryWrapper<>();
         agreementQueryWrapper.in(StateAgreement::getStateHouseholdId, houseIdList);
         agreementQueryWrapper.isNotNull(StateAgreement::getAgreementNumber);
+        //查询协议
         List<StateAgreement> agreementList = stateAgreementMapper.selectList(agreementQueryWrapper);
         if (CollectionUtils.isEmpty(agreementList)) {
             return new ArrayList<>(result);
@@ -680,10 +698,12 @@
 
                 if (innerAgreementMap.containsKey(AgreementTypeEnum.STATE_AGREEMENT.getValue())) {
                     StateAgreement stateAgreement = innerAgreementMap.get(AgreementTypeEnum.STATE_AGREEMENT.getValue());
+                    //正式签字时间
                     data.setOfficialSignedTime(stateAgreement.getSignAt());
                 }
                 if (innerAgreementMap.containsKey(AgreementTypeEnum.VIRTUAL_STATE_AGREEMENT.getValue())) {
                     StateAgreement virtualAgreement = innerAgreementMap.get(AgreementTypeEnum.VIRTUAL_STATE_AGREEMENT.getValue());
+                    //模拟签字时间
                     data.setVirtualSignedTime(virtualAgreement.getSignAt());
                 }
 
@@ -713,7 +733,7 @@
             return new HashMap<>();
         }
 
-
+        //查询房产
         LambdaQueryWrapper<StateHousehold> householdQueryWrapper = new LambdaQueryWrapper<>();
         householdQueryWrapper.in(StateHousehold::getStateProjectId, projectIdList);
         if (StringUtils.isNoneBlank(projectStreet)) {
@@ -731,8 +751,8 @@
         Map<String, Map<Integer, ProjectExecutionSumVO>> result = new HashMap<>();
 
         Map<String, List<StateHousehold>> householdMap = households.stream().collect(Collectors.groupingBy(StateHousehold::getStateProjectId));
-
-        List<String> houseIdList = households.stream().map(StateHousehold::getId).collect(Collectors.toList());
+        //废弃代码
+        //List<String> houseIdList = households.stream().map(StateHousehold::getId).collect(Collectors.toList());
         List<String> acceptHoustIdList = households.stream().filter(e ->
                 Objects.nonNull(e.getAgreementStatus())
         ).map(StateHousehold::getId).collect(Collectors.toList());
@@ -905,10 +925,10 @@
                         .count();
 
                 long notSignedVirtualPerson = innerHouseList.size() - signedVirtualPerson;
-
+                //计算正式签约的比例
                 appendData(searchedPersons, notSearchedPersons, innerHouseId, signedStatePerson, notSignedStatePerson, projectStateExecutionSumVO);
 
-
+                //计算模拟签约的比例
                 appendData(searchedPersons, notSearchedPersons, innerHouseId, signedVirtualPerson, notSignedVirtualPerson, projectVirtualExecutionSumVO);
 
                 Map<Integer, ProjectExecutionSumVO> projectExecutionSumVOMap = new HashMap<>();
@@ -961,6 +981,7 @@
                     stateHouseholds.stream().map(StateHousehold::getId).collect(Collectors.toList()));
             stateSettlementLambdaQueryWrapper.isNull(StateSettlement::getAuditStatus);
             stateSettlementLambdaQueryWrapper.orderByAsc(StateSettlement::getSettleName);
+            //查询安置情况
             stateSettlementList = this.list(stateSettlementLambdaQueryWrapper);
             if (ObjectUtil.isNotEmpty(stateSettlementList)) {
                 StateHousehold stateHousehold = stateHouseholdMap.get(stateSettlementList.get(0).getStateHouseholdId());
@@ -1008,6 +1029,11 @@
         return "第" + batchNum + "批次";
     }
 
+    /**
+     * 当前项目批次列表
+     * @param projectId
+     * @return
+     */
     @Override
     public List<String> listBatchName(String projectId) {
         if (StringUtils.isEmpty(projectId)) {
@@ -1039,8 +1065,9 @@
         if (CollectionUtils.isEmpty(stateSettlement)) {
             throw new GlobalException("数据不能为空");
         }
-
+        //新增的
         List<StateSettlement> newAddList = stateSettlement.stream().filter(e -> Objects.isNull(e.getId())).collect(Collectors.toList());
+        //编辑的
         List<StateSettlement> oldUpdateList = stateSettlement.stream().filter(e -> Objects.nonNull(e.getId())).collect(Collectors.toList());
 
 
@@ -1055,7 +1082,7 @@
                 data.setSettlementArea(areaMap.get(data.getStateHouseholdId()));
             }
         });
-
+        //全为编辑
         if (CollectionUtils.isEmpty(newAddHouseId)) {
             this.saveOrUpdateBatch(oldUpdateList);
             return;
@@ -1091,9 +1118,10 @@
         LambdaQueryWrapper<StateSettlement> lqw = new LambdaQueryWrapper<>();
         lqw.in(StateSettlement::getStateHouseholdId, newAddHouseId).ne(StateSettlement::getDelFlag, DeleteFlagEnum.DELETED.getKey());
         List<StateSettlement> list = this.list(lqw);
+        //新增
         if (CollectionUtils.isEmpty(list)) {
 
-            //查询当前批次是否存在已经拒绝的,如果有则代表是 审核失败编辑页面新增的情况,这里需要吧审核状态设置为已拒绝
+            //查询当前批次是否存在已经拒绝的,如果有则代表是 审核失败编辑页面新增的情况,这里需要吧审核状态设置为已拒绝 同一批次,审核状态统一,要么全为接收要么全为退回
             LambdaQueryWrapper<StateHousehold> queryWrapper = new LambdaQueryWrapper<>();
             queryWrapper.eq(StateHousehold::getStateProjectId, projectId);
             List<StateHousehold> allHousehold = stateHouseholdMapper.selectList(queryWrapper);
@@ -1422,7 +1450,15 @@
         saveOrUpdateBatch(stateSettlement);
     }
 
-
+    /**
+     * 计算签约、未签约比例数据
+     * @param searchedPersons
+     * @param notSearchedPersons
+     * @param innerHouseId
+     * @param signedVirtualPerson
+     * @param notSignedVirtualPerson
+     * @param projectVirtualExecutionSumVO
+     */
     private void appendData(long searchedPersons, long notSearchedPersons, List<String> innerHouseId, long signedVirtualPerson, long notSignedVirtualPerson, ProjectExecutionSumVO projectVirtualExecutionSumVO) {
         projectVirtualExecutionSumVO.setSignedPersons(signedVirtualPerson);
         projectVirtualExecutionSumVO.setNotSignedPersons(notSignedVirtualPerson);

--
Gitblit v1.7.1