From 11a5593a0536e8e98c88c625b918c4b3a30202c9 Mon Sep 17 00:00:00 2001 From: orangebabu <2409692770@qq.com> Date: Tue, 3 Jun 2025 16:57:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/config/cash-flow-balance.vue | 85 +++++++++++++------ .../entity/vo/CashFlowSubjectBalanceVo.java | 24 ++++++ .../service/ConfigCashFlowBalanceService.java | 16 ++-- .../ConfigCashFlowBalanceServiceImpl.java | 17 ++-- .../impl/StatementReportServiceImpl.java | 10 +-- .../ConfigCashFlowBalanceController.java | 13 +-- 6 files changed, 114 insertions(+), 51 deletions(-) create mode 100644 jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/vo/CashFlowSubjectBalanceVo.java diff --git a/jinbooks-ui/src/views/config/cash-flow-balance.vue b/jinbooks-ui/src/views/config/cash-flow-balance.vue index 4f177ff..75d26a0 100644 --- a/jinbooks-ui/src/views/config/cash-flow-balance.vue +++ b/jinbooks-ui/src/views/config/cash-flow-balance.vue @@ -62,32 +62,43 @@ - - + :title="balanceTitle"> +
-

{{formatBalance(endingBalance)}}

+

{{ formatBalance(endingBalance) }}

0.00

期末现金及现金等价物余额(38行)

-
-

{{formatBalance(startingBalance)}}

+
+

{{ formatBalance(startingBalance) }}

0.00

科目初始余额

+ +
+ +
+ ·{{ item.code }}{{ item.name }} + {{ formatBalance(item.balance)}} +
=
-

{{formatBalance(difference)}}

+

{{ formatBalance(difference) }}

0.00

差额

@@ -114,12 +125,11 @@ import {ElForm} from "element-plus"; const {t} = useI18n() const {proxy} = getCurrentInstance()!; const dataList: any = ref([]); +const bookInitBalances: any = ref([]); const loading: any = ref(false); const data = reactive({ queryParams: {}, - form: { - - } + form: {} }); const {queryParams, form} = toRefs(data); const inputRef = ref(null); @@ -154,26 +164,26 @@ const manualInputRows = [2, 3, 4, 6, 7, 8, 9, 13, 14, 15, 16, 17, 19, 20, 21, 22 // 按依赖关系排序的计算规则 const calculationRules = [ // 一级计算 (直接依赖手动输入的行) - { targetIndex: 5, type: 'sum', sourceIndices: [2, 3, 4] }, // 经营活动现金流入小计 - { targetIndex: 10, type: 'sum', sourceIndices: [6, 7, 8, 9] }, // 经营活动现金流出小计 - { targetIndex: 18, type: 'sum', sourceIndices: [13, 14, 15, 16, 17] }, // 投资活动现金流入小计 - { targetIndex: 23, type: 'sum', sourceIndices: [19, 20, 21, 22] }, // 投资活动现金流出小计 - { targetIndex: 29, type: 'sum', sourceIndices: [26, 27, 28] }, // 筹资活动现金流入小计 - { targetIndex: 33, type: 'sum', sourceIndices: [30, 31, 32] }, // 筹资活动现金流出小计 + {targetIndex: 5, type: 'sum', sourceIndices: [2, 3, 4]}, // 经营活动现金流入小计 + {targetIndex: 10, type: 'sum', sourceIndices: [6, 7, 8, 9]}, // 经营活动现金流出小计 + {targetIndex: 18, type: 'sum', sourceIndices: [13, 14, 15, 16, 17]}, // 投资活动现金流入小计 + {targetIndex: 23, type: 'sum', sourceIndices: [19, 20, 21, 22]}, // 投资活动现金流出小计 + {targetIndex: 29, type: 'sum', sourceIndices: [26, 27, 28]}, // 筹资活动现金流入小计 + {targetIndex: 33, type: 'sum', sourceIndices: [30, 31, 32]}, // 筹资活动现金流出小计 // 二级计算 (依赖一级计算结果) - { targetIndex: 11, type: 'diff', minuend: 5, subtrahend: 10 }, // 经营活动产生的现金流量净额 - { targetIndex: 24, type: 'diff', minuend: 18, subtrahend: 23 }, // 投资活动产生的现金流量净额 - { targetIndex: 34, type: 'diff', minuend: 29, subtrahend: 33 }, // 筹资活动产生的现金流量净额 + {targetIndex: 11, type: 'diff', minuend: 5, subtrahend: 10}, // 经营活动产生的现金流量净额 + {targetIndex: 24, type: 'diff', minuend: 18, subtrahend: 23}, // 投资活动产生的现金流量净额 + {targetIndex: 34, type: 'diff', minuend: 29, subtrahend: 33}, // 筹资活动产生的现金流量净额 // 三级计算 (依赖二级计算结果) - { targetIndex: 36, type: 'sum', sourceIndices: [11, 24, 34, 35] }, // 现金及现金等价物净增加额 + {targetIndex: 36, type: 'sum', sourceIndices: [11, 24, 34, 35]}, // 现金及现金等价物净增加额 // 四级计算 - { targetIndex: 38, type: 'sum', sourceIndices: [36, 37] }, // 期末现金及现金等价物余额 = 期初余额 + 净增加额 + {targetIndex: 38, type: 'sum', sourceIndices: [36, 37]}, // 期末现金及现金等价物余额 = 期初余额 + 净增加额 // 现金及现金等价物净增加额计算 - { targetIndex: 67, type: 'complexDiff', sourceIndices: [63, 64, 65, 66] }, // 现金及现金等价物净增加额 = 现金的期末余额 - 减:现金的期初余额 + 加:现金等价物的期末余额 - 减:现金等价物的期初余额 + {targetIndex: 67, type: 'complexDiff', sourceIndices: [63, 64, 65, 66]}, // 现金及现金等价物净增加额 = 现金的期末余额 - 减:现金的期初余额 + 加:现金等价物的期末余额 - 减:现金等价物的期初余额 // 新增:第二种方法计算经营活动现金流量净额,除了"其他"项 { @@ -338,7 +348,7 @@ watch( } } }, - { deep: true } + {deep: true} ); // 行类名方法 @@ -352,12 +362,14 @@ const tableRowClassName = ({row, rowIndex}: { row: TableItem; rowIndex: number } function getList() { loading.value = true; fetchPage(queryParams.value).then((response: any) => { - dataList.value = response.data.map((item: any) => ({ + dataList.value = response.data.configCashFlowBalances.map((item: any) => ({ ...item, editing: false, inputBalance: item.balance })); + bookInitBalances.value = response.data.bookInitBalances; + loading.value = false; // 在数据加载完成后执行一次计算 calculateAllValues(); @@ -592,7 +604,7 @@ getList(); .balance-calculation { display: flex; - justify-content: center; + justify-content: space-around; align-items: flex-start; margin: 30px 0; gap: 20px; @@ -623,4 +635,27 @@ getList(); color: #909399; margin-top: 4px; /* 调整操作符垂直对齐位置 */ } + +.balance-divider { + margin: 10px auto; + border: none; + border-top: 1px solid #eee; + width: 80%; +} + +.balance-detail { + display: flex; + justify-content: space-between; + font-size: 12px; + color: #666; + padding: 2px 20px; +} + +.balance-detail-left { + text-align: left; +} + +.balance-detail-right { + text-align: right; +} diff --git a/jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/vo/CashFlowSubjectBalanceVo.java b/jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/vo/CashFlowSubjectBalanceVo.java new file mode 100644 index 0000000..9d5460f --- /dev/null +++ b/jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/vo/CashFlowSubjectBalanceVo.java @@ -0,0 +1,24 @@ +package com.jinbooks.entity.vo; + +import com.jinbooks.entity.base.BookInitBalance; +import com.jinbooks.entity.config.ConfigCashFlowBalance; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +/** + * @description: + * @author: orangeBabu + * @time: 2025/6/3 16:37 + */ + +@Data +@NoArgsConstructor +@AllArgsConstructor +public class CashFlowSubjectBalanceVo { + List configCashFlowBalances; + + List bookInitBalances; +} diff --git a/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/ConfigCashFlowBalanceService.java b/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/ConfigCashFlowBalanceService.java index 3a6d63f..914c7a3 100644 --- a/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/ConfigCashFlowBalanceService.java +++ b/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/ConfigCashFlowBalanceService.java @@ -1,12 +1,12 @@ /* * Copyright [2025] [JinBooks of copyright http://www.jinbooks.com] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -14,7 +14,7 @@ * limitations under the License. * */ - + package com.jinbooks.persistence.service; @@ -24,13 +24,15 @@ import com.jinbooks.entity.book.dto.BookChangeDto; import com.jinbooks.entity.config.ConfigCashFlowBalance; import com.jinbooks.entity.config.dto.ConfigCashFlowChangeDto; import com.jinbooks.entity.config.dto.ConfigCashFlowPageDto; +import com.jinbooks.entity.vo.CashFlowSubjectBalanceVo; + import java.util.List; /** * @author 24096 */ public interface ConfigCashFlowBalanceService extends IService { - Message> pageList(ConfigCashFlowPageDto dto); + Message pageList(ConfigCashFlowPageDto dto); /** * @Description: 获取现金流量选择项 @@ -42,8 +44,8 @@ public interface ConfigCashFlowBalanceService extends IService> getSelectItem(Integer cashFlowItemType); Message save(ConfigCashFlowChangeDto dto); - + boolean deleteByBookIds(List bookIds); - + boolean configCashFlowBalance(BookChangeDto dto); } diff --git a/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/impl/ConfigCashFlowBalanceServiceImpl.java b/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/impl/ConfigCashFlowBalanceServiceImpl.java index 8805edf..fce3a0d 100644 --- a/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/impl/ConfigCashFlowBalanceServiceImpl.java +++ b/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/impl/ConfigCashFlowBalanceServiceImpl.java @@ -1,12 +1,12 @@ /* * Copyright [2025] [JinBooks of copyright http://www.jinbooks.com] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -14,7 +14,7 @@ * limitations under the License. * */ - + package com.jinbooks.persistence.service.impl; @@ -27,6 +27,7 @@ import com.jinbooks.entity.book.dto.BookChangeDto; import com.jinbooks.entity.config.ConfigCashFlowBalance; import com.jinbooks.entity.config.dto.ConfigCashFlowChangeDto; import com.jinbooks.entity.config.dto.ConfigCashFlowPageDto; +import com.jinbooks.entity.vo.CashFlowSubjectBalanceVo; import com.jinbooks.exception.BusinessException; import com.jinbooks.persistence.mapper.BookInitBalanceMapper; import com.jinbooks.persistence.mapper.ConfigCashFlowBalanceMapper; @@ -56,12 +57,13 @@ public class ConfigCashFlowBalanceServiceImpl extends ServiceImpl> pageList(ConfigCashFlowPageDto dto) { + public Message pageList(ConfigCashFlowPageDto dto) { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(ConfigCashFlowBalance::getBookId, dto.getBookId()) .orderByAsc(ConfigCashFlowBalance::getSortIndex); List list = super.list(wrapper); + //获取科目初始余额 LambdaQueryWrapper wrapperBookInit = new LambdaQueryWrapper<>(); wrapperBookInit.eq(BookInitBalance::getBookId, dto.getBookId()); wrapperBookInit.eq(BookInitBalance::getLevel, 1); @@ -115,9 +117,8 @@ public class ConfigCashFlowBalanceServiceImpl extends ServiceImpl wrapperBookInit = new LambdaQueryWrapper<>(); wrapperBookInit.eq(BookInitBalance::getBookId, bookId); wrapperBookInit.eq(BookInitBalance::getLevel, 1); diff --git a/jinbooks/jinbooks-web/src/main/java/com/jinbooks/web/config/contorller/ConfigCashFlowBalanceController.java b/jinbooks/jinbooks-web/src/main/java/com/jinbooks/web/config/contorller/ConfigCashFlowBalanceController.java index 3e5a5c1..193eb58 100644 --- a/jinbooks/jinbooks-web/src/main/java/com/jinbooks/web/config/contorller/ConfigCashFlowBalanceController.java +++ b/jinbooks/jinbooks-web/src/main/java/com/jinbooks/web/config/contorller/ConfigCashFlowBalanceController.java @@ -1,12 +1,12 @@ /* * Copyright [2025] [JinBooks of copyright http://www.jinbooks.com] - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -14,12 +14,13 @@ * limitations under the License. * */ - + package com.jinbooks.web.config.contorller; import java.util.List; +import com.jinbooks.entity.vo.CashFlowSubjectBalanceVo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springdoc.core.annotations.ParameterObject; @@ -57,8 +58,8 @@ public class ConfigCashFlowBalanceController { private final ConfigCashFlowBalanceService configCashFlowService; @GetMapping(value = {"/fetch"}) - public Message> fetch(@ParameterObject ConfigCashFlowPageDto dto, - @CurrentUser UserInfo currentUser) { + public Message fetch(@ParameterObject ConfigCashFlowPageDto dto, + @CurrentUser UserInfo currentUser) { logger.debug("fetch {}", dto); dto.setBookId(currentUser.getBookId()); return configCashFlowService.pageList(dto);