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/StateAssetServiceImpl.java |  126 +++++++++++++++++++----------------------
 1 files changed, 59 insertions(+), 67 deletions(-)

diff --git a/land-system/src/main/java/com/zzg/system/service/state/impl/StateAssetServiceImpl.java b/land-system/src/main/java/com/zzg/system/service/state/impl/StateAssetServiceImpl.java
index 2ded1fc..4987698 100644
--- a/land-system/src/main/java/com/zzg/system/service/state/impl/StateAssetServiceImpl.java
+++ b/land-system/src/main/java/com/zzg/system/service/state/impl/StateAssetServiceImpl.java
@@ -8,20 +8,33 @@
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageInfo;
-import com.zzg.common.core.domain.entity.state.*;
+import com.zzg.common.core.domain.entity.state.StateAgreement;
+import com.zzg.common.core.domain.entity.state.StateAsset;
+import com.zzg.common.core.domain.entity.state.StateHousehold;
+import com.zzg.common.core.domain.entity.state.StateProject;
+import com.zzg.common.core.domain.entity.state.StateSettlement;
 import com.zzg.common.core.domain.entity.system.SysDept;
-import com.zzg.common.enums.*;
+import com.zzg.common.enums.AgreementTypeEnum;
+import com.zzg.common.enums.CompensationCategoryEnum;
+import com.zzg.common.enums.DeleteFlagEnum;
+import com.zzg.common.enums.ProcessCategoryEnum;
+import com.zzg.common.enums.StateProjectStatusEnum;
+import com.zzg.common.enums.SubmitStatusEnum;
 import com.zzg.common.exception.GlobalException;
 import com.zzg.common.utils.PageUtils;
 import com.zzg.common.utils.SecurityUtils;
-import com.zzg.common.utils.StringUtils;
 import com.zzg.system.domain.bo.AssetDetailBO;
 import com.zzg.system.domain.bo.FileBO;
 import com.zzg.system.domain.bo.ProcessStartBO;
 import com.zzg.system.domain.bo.StateAssetBO;
 import com.zzg.system.domain.vo.StateAssetDetailVO;
 import com.zzg.system.mapper.state.StateAssetMapper;
-import com.zzg.system.service.state.*;
+import com.zzg.system.service.state.StateAgreementService;
+import com.zzg.system.service.state.StateAssetService;
+import com.zzg.system.service.state.StateHouseholdService;
+import com.zzg.system.service.state.StateProcessTemplateService;
+import com.zzg.system.service.state.StateProjectService;
+import com.zzg.system.service.state.StateSettlementService;
 import com.zzg.system.service.system.ISysDeptService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.context.annotation.Lazy;
@@ -31,72 +44,55 @@
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+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;
 
 @Service
 @RequiredArgsConstructor
 
-public class StateAssetServiceImpl
-        extends ServiceImpl<StateAssetMapper, StateAsset>
-        implements StateAssetService {
+public class StateAssetServiceImpl extends ServiceImpl<StateAssetMapper, StateAsset> implements StateAssetService {
 
 
     private final StateAgreementService agreementService;
-
     private final StateAssetMapper assetMapper;
-
     private final StateSettlementService settlementService;
-
     @Lazy
     @Resource
     private final StateProjectService stateProjectService;
-
     @Lazy
     @Resource
     private final StateHouseholdService stateHouseholdService;
-
     @Lazy
     @Resource
     private final StateProcessTemplateService stateProcessTemplateService;
-
-    @Lazy
-    @Resource
-    private final StateHouseholdOwnerService stateHouseholdOwnerService;
-
     @Lazy
     @Resource
     private final ISysDeptService deptService;
 
+    /**
+     * 项目资金点击上方符号查询
+     * @param assetDetailBO
+     * @return
+     */
     @Override
     public PageInfo<StateAssetDetailVO> listAssetDetail(AssetDetailBO assetDetailBO) {
-
-
+        //查询项目信息
         StateProject stateProject = stateProjectService.getById(assetDetailBO.getProjectId());
-
         Integer currentStatus = stateProject.getStatus();
 
         PageUtils.startPage();
+        //查询项目预算资金详情
         List<StateAssetDetailVO> assetDetailVOList = assetMapper.listAssetDetail(assetDetailBO, currentStatus);
         if (CollectionUtils.isEmpty(assetDetailVOList)) {
             return new PageInfo<>();
         }
         PageInfo<StateAssetDetailVO> stateAssetDetailVOPageInfo = new PageInfo<>(assetDetailVOList);
-//        //组装名字
-//        List<String> houseIdList = assetDetailVOList.stream().map(StateAssetDetailVO::getHouseId).collect(Collectors.toList());
-//        LambdaQueryWrapper<StateHouseholdOwner> householdOwnerLambdaQueryWrapper = new LambdaQueryWrapper<>();
-//        householdOwnerLambdaQueryWrapper.in(StateHouseholdOwner::getStateHouseholdId, houseIdList);
-//
-//        if (!StringUtils.isEmpty(assetDetailBO.getOwnerName())) {
-//            householdOwnerLambdaQueryWrapper.like(StateHouseholdOwner::getOwnerName, assetDetailBO.getOwnerName());
-//        }
-//        List<StateHouseholdOwner> stateHouseholdOwners = stateHouseholdOwnerService.list(householdOwnerLambdaQueryWrapper);
-
-//        Map<String, List<StateHouseholdOwner>> ownerMap = stateHouseholdOwners.stream().collect(Collectors.groupingBy(StateHouseholdOwner::getStateHouseholdId));
-//        if (!StringUtils.isEmpty(assetDetailBO.getOwnerName())) {
-//            assetDetailVOList = assetDetailVOList.stream().filter(data -> ownerMap.containsKey(data.getHouseId())).collect(Collectors.toList());
-//        }
         stateAssetDetailVOPageInfo.setList(assetDetailVOList);
         Map<String, List<StateAssetDetailVO>> listMap = stateAssetDetailVOPageInfo.getList().stream().collect(Collectors.groupingBy(StateAssetDetailVO::getHouseId));
 
@@ -105,15 +101,9 @@
         for (String houseId : listMap.keySet()) {
             List<StateAssetDetailVO> stateAssetDetailVOList = listMap.get(houseId);
             StateAssetDetailVO assetDetailVO = stateAssetDetailVOList.get(0);
-//            //组装名字
-//            if (ownerMap.containsKey(houseId)) {
-//                String fullName = ownerMap.get(houseId).stream().map(StateHouseholdOwner::getOwnerName).collect(Collectors.joining("|"));
-//                assetDetailVO.setOwnerName(fullName);
-//                assetDetailVO.setPersonNum(ownerMap.get(houseId).size());
-//            }
             result.add(assetDetailVO);
         }
-
+        //国有项目协议查询条件
         LambdaQueryWrapper<StateAgreement> stateAgreementLambdaQueryWrapper = new LambdaQueryWrapper<>();
         stateAgreementLambdaQueryWrapper.in(StateAgreement::getStateHouseholdId, result.stream().map(StateAssetDetailVO::getHouseId).collect(Collectors.toList()));
         //根据项目状态查询协议 这一个项目状态只有一种 随便取出来即可
@@ -127,6 +117,7 @@
             }
         }
         stateAgreementLambdaQueryWrapper.isNotNull(StateAgreement::getAgreementNumber);
+        //查询协议列表
         List<StateAgreement> stateAgreements = agreementService.list(stateAgreementLambdaQueryWrapper);
         if (CollectionUtils.isEmpty(stateAgreements)) {
             stateAssetDetailVOPageInfo.setList(result);
@@ -146,43 +137,49 @@
         LambdaQueryWrapper<StateSettlement> stateSettlementLambdaQueryWrapper = new LambdaQueryWrapper<>();
         stateSettlementLambdaQueryWrapper.in(StateSettlement::getStateHouseholdId,
                 result.stream().map(StateAssetDetailVO::getHouseId).collect(Collectors.toList()));
+        //查询已结算金额
         List<StateSettlement> stateSettlementList = settlementService.list(stateSettlementLambdaQueryWrapper);
 
 
         Map<String, StateSettlement> stateSettlementMap = stateSettlementList.stream()
                 .collect(Collectors.toMap(StateSettlement::getStateHouseholdId, Function.identity()));
+        //赋值结算金额
         result.forEach(data -> {
-
             StateSettlement stateSettlement = stateSettlementMap.get(data.getHouseId());
             if (Objects.isNull(stateSettlement)) {
                 return;
             }
+            //TODO 置换后金额含义
+            // 结算金额
             Double dbSettleMoney = Objects.nonNull(stateSettlement.getSettlementMoney()) ? stateSettlement.getSettlementMoney() : 0;
-
+            //置换后金额
             Double dbExchangeMoney = Objects.nonNull(stateSettlement.getExchangeMoney()) ? stateSettlement.getExchangeMoney() : 0;
-
             BigDecimal settleMoney = BigDecimal.valueOf(dbSettleMoney + dbExchangeMoney).setScale(4, RoundingMode.HALF_UP);
-
             data.setSettleMoney(settleMoney);
             Number agreementMoney = Objects.nonNull(data.getAgreementMoney()) ? data.getAgreementMoney() : 0;
             settleMoney = Objects.nonNull(data.getSettleMoney()) ? data.getSettleMoney() : BigDecimal.ZERO;
             data.setDiffMoney(BigDecimal.valueOf(agreementMoney.doubleValue()).subtract(settleMoney));
             data.setPaidOffTime(Objects.nonNull(stateSettlement.getPaidTime()) ? stateSettlement.getPaidTime() : null);
-
         });
 
         stateAssetDetailVOPageInfo.setList(result);
         return stateAssetDetailVOPageInfo;
     }
 
+    /**
+     * 项目资金 上方统计数据
+     * @param projectId
+     * @return
+     */
     @Override
     public JSONObject sumAsset(String projectId) {
         JSONObject jsonObject = new JSONObject();
-
+        //查询项目信息
         StateProject stateProject = stateProjectService.getProjectById(projectId);
-
+        // TODO 未将逻辑删除的字段过滤
         LambdaQueryWrapper<StateAsset> stateAssetQueryWrapper = new LambdaQueryWrapper<>();
         stateAssetQueryWrapper.eq(StateAsset::getStateProjectId, projectId);
+        //查询项目预算资金
         List<StateAsset> stateAssets = this.list(stateAssetQueryWrapper);
 
         //预算金额
@@ -191,15 +188,13 @@
                 .sum();
         String roundedBudgetAmount = BigDecimal.valueOf(budgetAmount)
                 .setScale(4, RoundingMode.HALF_UP).toPlainString();
-
         jsonObject.put("budgetAmount", roundedBudgetAmount);
-
         //合同金额
         LambdaQueryWrapper<StateHousehold> stateHouseholdLambdaQueryWrapper = new LambdaQueryWrapper<>();
         stateHouseholdLambdaQueryWrapper.eq(StateHousehold::getStateProjectId, projectId);
-//        stateHouseholdLambdaQueryWrapper.eq(StateHousehold::getAgreementStatus,SubmitStatusEnum.ACCEPT.getValue());
         stateHouseholdLambdaQueryWrapper.eq(StateHousehold::getDelFlag, DeleteFlagEnum.NOT_DELETED.getKey());
         stateHouseholdLambdaQueryWrapper.isNotNull(StateHousehold::getAgreementStatus);
+        //根据项目id查询房产数据
         List<StateHousehold> stateHouseholds = stateHouseholdService.list(stateHouseholdLambdaQueryWrapper);
 
         if (CollectionUtils.isEmpty(stateHouseholds)) {
@@ -221,12 +216,11 @@
             }
         }
 
-
         stateAgreementLambdaQueryWrapper.isNotNull(StateAgreement::getAgreementNumber);
         stateAgreementLambdaQueryWrapper.in(StateAgreement::getStateHouseholdId, houseIds);
+        //查询协议信息
         List<StateAgreement> stateAgreements = agreementService.list(stateAgreementLambdaQueryWrapper);
         if (CollectionUtils.isNotEmpty(stateAgreements)) {
-
             Integer projectStatus = stateProject.getStatus();
             if (Objects.equals(projectStatus, StateProjectStatusEnum.SIMULATE.getKey())) {
                 stateAgreementLambdaQueryWrapper.eq(StateAgreement::getAgreementFileType, AgreementTypeEnum.VIRTUAL_STATE_AGREEMENT.getValue());
@@ -236,7 +230,7 @@
                 stateAgreementLambdaQueryWrapper.eq(StateAgreement::getAgreementFileType, AgreementTypeEnum.STATE_AGREEMENT.getValue());
                 stateAgreements = stateAgreements.stream().filter(e -> e.getAgreementFileType().equals(AgreementTypeEnum.STATE_AGREEMENT.getValue())).collect(Collectors.toList());
             }
-
+            // 协议金额
             double agreementMoney = stateAgreements.stream()
                     .filter(Objects::nonNull)
                     .filter(data -> Objects.nonNull(data.getMoney())).mapToDouble(StateAgreement::getMoney).sum();
@@ -246,16 +240,15 @@
 
             jsonObject.put("agreementMoney", agreementMoneyBig);
         }
-
+        //将该项目下面的房产数据类型为产权置换的房产id筛选出来
         List<String> componseTypeHouseIds = stateHouseholds.stream().filter(data -> ObjectUtil.isNotEmpty(data.getCompensationType())
                 && data.getCompensationType().equals(CompensationCategoryEnum.PROPERTY_SWAP_2.getCode())).map(StateHousehold::getId).collect(Collectors.toList());
-
+        //产权置换下的合金额
         BigDecimal roundedAgreementMoney = BigDecimal.ZERO;
-
-
         if (ObjectUtil.isNotEmpty(componseTypeHouseIds)) {
             componseTypeAgreementLambdaQueryWrapper.isNotNull(StateAgreement::getAgreementNumber);
             componseTypeAgreementLambdaQueryWrapper.in(StateAgreement::getStateHouseholdId, componseTypeHouseIds);
+            //根据房产id查询协议列表
             List<StateAgreement> stateAgreementsInDb = agreementService.list(componseTypeAgreementLambdaQueryWrapper);
             if (CollectionUtils.isNotEmpty(stateAgreementsInDb)) {
                 double agreementMoney = stateAgreementsInDb.stream()
@@ -271,11 +264,8 @@
         stateSettlementLambdaQueryWrapper.in(StateSettlement::getStateHouseholdId, houseIds);
         stateSettlementLambdaQueryWrapper.isNotNull(StateSettlement::getAuditStatus);
         List<StateSettlement> stateSettlementList = settlementService.list(stateSettlementLambdaQueryWrapper);
-
         jsonObject.put("settlementMoney", 0);
         if (CollectionUtils.isNotEmpty(stateSettlementList)) {
-
-
             Double settlementMoney = stateSettlementList.stream()
                     .mapToDouble(stateSettlement -> {
                         Double settlementMoneyValue = stateSettlement.getSettlementMoney();
@@ -295,22 +285,23 @@
             // 四舍五入保留两位小数
             String roundedSettlementMoney = BigDecimal.valueOf(settlementMoney)
                     .setScale(4, RoundingMode.HALF_UP).toPlainString();
-
-
             jsonObject.put("settlementMoney", roundedSettlementMoney);
         }
         jsonObject.put("status", stateProject.getStatus());
-
         return jsonObject;
     }
 
+    /**
+     * 新增和修改 项目资金
+     * @param asset
+     * @return
+     */
     @Transactional
     @Override
     public boolean saveAsset(StateAssetBO asset) {
         String deptId = SecurityUtils.getLoginUser().getUser().getDept().getDeptId();
-
+        //根据当前登录人部门id查询部门信息
         Map<String, SysDept> stringSysDeptMap = deptService.selectMapDeptById(Collections.singletonList(deptId));
-
         asset.setSubmittedBy(stringSysDeptMap.values().stream().map(SysDept::getDeptName).collect(Collectors.joining(",")));
 
         if (CollectionUtils.isNotEmpty(asset.getFileBOList())) {
@@ -345,6 +336,7 @@
         variable.put("projectId", asset.getStateProjectId());
         variable.put("street", asset.getStreet());
         processStartBO.setVariable(variable);
+        //启动工作流
         stateProcessTemplateService.start(processStartBO);
         return result;
     }

--
Gitblit v1.7.1