From 61219a6817b99266dc91be4362513161c36941b9 Mon Sep 17 00:00:00 2001 From: jinbooks_dev Date: Thu, 3 Jul 2025 17:23:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../statement/StatementSubjectBalance.java | 2 +- .../StatementSubjectBalanceOpening.java | 188 ++++++++++++++++++ .../StatementSubjectBalanceOpeningMapper.java | 27 +++ .../StatementSubjectBalanceServiceImpl.java | 13 ++ 4 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/statement/StatementSubjectBalanceOpening.java create mode 100644 jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/mapper/StatementSubjectBalanceOpeningMapper.java diff --git a/jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/statement/StatementSubjectBalance.java b/jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/statement/StatementSubjectBalance.java index 3fa0386..c1b0168 100644 --- a/jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/statement/StatementSubjectBalance.java +++ b/jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/statement/StatementSubjectBalance.java @@ -28,7 +28,7 @@ import java.io.Serializable; import java.math.BigDecimal; /** - * 科目余额报表 jbx_statement_subject_balance + * 科目余额 jbx_statement_subject_balance * * @author wuyan * {@code @date} 2025-02-03 diff --git a/jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/statement/StatementSubjectBalanceOpening.java b/jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/statement/StatementSubjectBalanceOpening.java new file mode 100644 index 0000000..6252d7d --- /dev/null +++ b/jinbooks/jinbooks-core/src/main/java/com/jinbooks/entity/statement/StatementSubjectBalanceOpening.java @@ -0,0 +1,188 @@ +/* + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + +package com.jinbooks.entity.statement; + +import com.baomidou.mybatisplus.annotation.*; +import com.jinbooks.entity.BaseEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 科目余额期初数据 jbx_statement_subject_balance_opening + * + * @author wuyan + * {@code @date} 2025-02-03 + */ + +@EqualsAndHashCode(callSuper = true) +@Data +@TableName("jbx_statement_subject_balance_opening") +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class StatementSubjectBalanceOpening extends BaseEntity implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3640591095573870104L; + + /** + * 主键 + */ + @TableId(type = IdType.ASSIGN_ID) + private String id; + + /** + * 账套ID + */ + @Schema(name = "bookId", description = "所属账套") + private String bookId; + + @Schema(name = "yearPeriod", description = "期间") + private String yearPeriod; + + /** + * 报表周期(如:month、quarter、year) + */ + @Schema(name = "periodType", description = "报表周期(如:月、季、年)") + private String periodType; + + /** + * 排序序号 + */ + @Schema(name = "sortIndex", description = "排序序号") + private Integer sortIndex; + + /** + * 原始数据id + */ + @Schema(name = "sourceId", description = "原始数据id") + private String sourceId; + + /** + * 父级科目id + */ + @Schema(name = "parentId", description = "父级科目id") + private String parentId; + + /** + * 科目编码 + */ + @Schema(name = "subjectCode", description = "科目编码") + private String subjectCode; + + /** + * 科目名称 + */ + @Schema(name = "subjectName", description = "科目名称") + private String subjectName; + + /** + * 借贷方向 + */ + @Schema(name = "direction", description = "借贷方向") + String direction; + + /** + * 余额 + */ + @Schema(name = "balance", description = "余额") + private BigDecimal balance; + + /** + * 期初余额(借方) + */ + @Schema(name = "openingBalanceDebit", description = "期初余额(借方)") + private BigDecimal openingBalanceDebit; + + /** + * 期初余额(贷方) + */ + @Schema(name = "openingBalanceCredit", description = "期初余额(贷方)") + private BigDecimal openingBalanceCredit; + + /** + * 年初余额(借方) + */ + @Schema(name = "openingYearBalanceDebit", description = "年初余额(借方)") + private BigDecimal openingYearBalanceDebit; + + /** + * 年初余额(贷方) + */ + @Schema(name = "openingYearBalanceCredit", description = "年初余额(贷方)") + private BigDecimal openingYearBalanceCredit; + + /** + * 本期发生额(借方) + */ + @Schema(name = "currentPeriodDebit", description = "本期发生额(借方)") + private BigDecimal currentPeriodDebit; + + /** + * 本期发生额(贷方) + */ + @Schema(name = "currentPeriodCredit", description = "本期发生额(贷方)") + private BigDecimal currentPeriodCredit; + + /** + * 本年累计发生额(借方) + */ + @Schema(name = "yearToDateDebit", description = "本年累计发生额(借方)") + private BigDecimal yearToDateDebit; + + /** + * 本年累计发生额(贷方) + */ + @Schema(name = "yearToDateCredit", description = "本年累计发生额(贷方)") + private BigDecimal yearToDateCredit; + + /** + * 期末余额(借方) + */ + @Schema(name = "closingBalanceDebit", description = "期末余额(借方)") + private BigDecimal closingBalanceDebit; + + /** + * 期末余额(贷方) + */ + @Schema(name = "closingBalanceCredit", description = "期末余额(贷方)") + private BigDecimal closingBalanceCredit; + + /** + * 是否辅助核算项:n-否;y-是 + */ + private String isAuxiliary; + + /** + * 当前期是否使用:n-否;y-是 + */ + private String isVoucher; + + /** + * 删除标记,默认为 'n' (未删除),如果为 'y' 表示已删除 + */ + @TableField(fill = FieldFill.INSERT) + @TableLogic(value = "n", delval = "y") + private String deleted; +} diff --git a/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/mapper/StatementSubjectBalanceOpeningMapper.java b/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/mapper/StatementSubjectBalanceOpeningMapper.java new file mode 100644 index 0000000..0f9a16f --- /dev/null +++ b/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/mapper/StatementSubjectBalanceOpeningMapper.java @@ -0,0 +1,27 @@ +/* + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + + +package com.jinbooks.persistence.mapper; + +import com.jinbooks.entity.statement.StatementSubjectBalanceOpening; +import com.jinbooks.mapper.BaseMapperPlus; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface StatementSubjectBalanceOpeningMapper extends BaseMapperPlus { +} diff --git a/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/impl/StatementSubjectBalanceServiceImpl.java b/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/impl/StatementSubjectBalanceServiceImpl.java index 0fb81aa..83b7bf4 100644 --- a/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/impl/StatementSubjectBalanceServiceImpl.java +++ b/jinbooks/jinbooks-persistence/src/main/java/com/jinbooks/persistence/service/impl/StatementSubjectBalanceServiceImpl.java @@ -31,6 +31,7 @@ import com.jinbooks.entity.base.AssistAcc; import com.jinbooks.entity.book.BookSubject; import com.jinbooks.entity.book.Settlement; import com.jinbooks.entity.statement.StatementSubjectBalance; +import com.jinbooks.entity.statement.StatementSubjectBalanceOpening; import com.jinbooks.entity.voucher.VoucherAuxiliary; import com.jinbooks.entity.voucher.VoucherItem; import com.jinbooks.enums.StatementPeriodTypeEnum; @@ -40,9 +41,12 @@ import com.jinbooks.enums.YesNoEnum; import com.jinbooks.persistence.mapper.AssistAccMapper; import com.jinbooks.persistence.mapper.BookSubjectMapper; import com.jinbooks.persistence.mapper.StatementSubjectBalanceMapper; +import com.jinbooks.persistence.mapper.StatementSubjectBalanceOpeningMapper; import com.jinbooks.persistence.mapper.VoucherItemMapper; import com.jinbooks.persistence.service.ConfigSysService; import com.jinbooks.persistence.service.StatementSubjectBalanceService; + +import cn.hutool.core.bean.BeanUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -66,6 +70,7 @@ public class StatementSubjectBalanceServiceImpl implements StatementSubjectBalan private final AssistAccMapper assistAccMapper; private final IdentifierGenerator identifierGenerator; private final VoucherItemMapper voucherItemMapper; + private final StatementSubjectBalanceOpeningMapper statementSubjectBalanceOpeningMapper; @Override public StatementSubjectBalance getSubjectBalance(String bookId, String subjectCode) { @@ -454,6 +459,14 @@ public class StatementSubjectBalanceServiceImpl implements StatementSubjectBalan statementSubjectBalance.setId(currentId); } subjectBalanceMapper.insertBatch(subjectBalanceList); + List subjectBalanceOpeningList = new ArrayList<>(); + + for( StatementSubjectBalance statementSubjectBalance: subjectBalanceList) { + StatementSubjectBalanceOpening statementSubjectBalanceOpening = new StatementSubjectBalanceOpening(); + BeanUtil.copyProperties(statementSubjectBalance, statementSubjectBalanceOpening); + subjectBalanceOpeningList.add(statementSubjectBalanceOpening); + } + statementSubjectBalanceOpeningMapper.insertBatch(subjectBalanceOpeningList); return true; }