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/StateSettlementImpl.java |  109 ++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 89 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 d0edab1..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
@@ -302,11 +311,17 @@
         return result;
     }
 
+    /**
+     * 安置详情
+     * @param settlementDetailBO
+     * @return
+     */
     @Override
     public SettlementDetailPageVO listDetailData(SettlementDetailBO settlementDetailBO) {
         SettlementDetailPageVO pageVO = new SettlementDetailPageVO();
 
         PageUtils.startPage();
+        //分页查询安置情况
         List<SettlementDetailVO> settlementDetailVOS = settlementMapper.listSettleDetail(settlementDetailBO);
         if (CollectionUtils.isEmpty(settlementDetailVOS)) {
             pageVO.setPageData(new PageInfo<>());
@@ -316,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();
@@ -355,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();
@@ -429,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);
@@ -450,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);
@@ -531,6 +552,11 @@
         return settlementSumVO;
     }
 
+    /**
+     * 项目实施明细
+     * @param executionBO
+     * @return
+     */
     @Override
     public PageInfo<StateExecutionDetailVO> listExecution(StateExecutionBO executionBO) {
         PageUtils.startPage();
@@ -539,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());
@@ -604,6 +630,11 @@
         return pageInfo;
     }
 
+    /**
+     * 安置详情-回显
+     * @param executionB
+     * @return
+     */
     @Override
     public List<StateExecutionDetailVO> exportExecution(StateExecutionBO executionB) {
         if (StringUtils.isNoneBlank(executionB.getHouseStateId())) {
@@ -615,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()
@@ -629,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));
@@ -651,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);
@@ -665,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());
                 }
 
@@ -677,6 +712,12 @@
         return result;
     }
 
+    /**
+     * 给项目展示使用
+     * @param projectIdList
+     * @param projectStreet
+     * @return
+     */
     @Override
     public Map<String, Map<Integer, ProjectExecutionSumVO>> listProjectExecutionByProjectId(List<String> projectIdList, String projectStreet) {
 
@@ -692,7 +733,7 @@
             return new HashMap<>();
         }
 
-
+        //查询房产
         LambdaQueryWrapper<StateHousehold> householdQueryWrapper = new LambdaQueryWrapper<>();
         householdQueryWrapper.in(StateHousehold::getStateProjectId, projectIdList);
         if (StringUtils.isNoneBlank(projectStreet)) {
@@ -710,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());
@@ -884,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<>();
@@ -940,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());
@@ -987,6 +1029,11 @@
         return "第" + batchNum + "批次";
     }
 
+    /**
+     * 当前项目批次列表
+     * @param projectId
+     * @return
+     */
     @Override
     public List<String> listBatchName(String projectId) {
         if (StringUtils.isEmpty(projectId)) {
@@ -1008,14 +1055,19 @@
         return stateSettlementList.stream().map(StateSettlement::getSettleName).distinct().collect(Collectors.toList());
     }
 
+    /**
+     * 安置情况保存
+     * @param stateSettlement
+     */
     @Override
     @Transactional
     public void saveOrUpdateSettlement(List<StateSettlement> stateSettlement) {
         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());
 
 
@@ -1030,7 +1082,7 @@
                 data.setSettlementArea(areaMap.get(data.getStateHouseholdId()));
             }
         });
-
+        //全为编辑
         if (CollectionUtils.isEmpty(newAddHouseId)) {
             this.saveOrUpdateBatch(oldUpdateList);
             return;
@@ -1066,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);
@@ -1101,6 +1154,10 @@
         }
     }
 
+    /**
+     * 新增安置情况 - 提交审核
+     * @param settlementIds
+     */
     @Override
     @Transactional
     public void workflowSubmit(List<String> settlementIds) {
@@ -1160,6 +1217,10 @@
         }
     }
 
+    /**
+     * 安置情况删除
+     * @param id
+     */
     @Override
     public void deleteSettlement(String id) {
         stateSettlementMapper.deleteSettlement(id);
@@ -1389,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