科目余额表增加上月数据

This commit is contained in:
jinbooks_dev
2025-07-04 16:46:00 +08:00
parent b46bfe03c8
commit 214b89230c
6 changed files with 66 additions and 228 deletions

View File

@ -168,6 +168,42 @@ public class StatementSubjectBalance extends BaseEntity implements Serializable
@Schema(name = "closingBalanceCredit", description = "期末余额(贷方)")
private BigDecimal closingBalanceCredit;
/**
* 上月末余额
*/
@Schema(name = "prevbalance", description = "上月余额")
@TableField(fill = FieldFill.INSERT)
private BigDecimal prevBalance;
/**
* 上月期末余额(借方)
*/
@Schema(name = "prevClosingBalanceDebit", description = "上月期末余额(借方)")
@TableField(fill = FieldFill.INSERT)
private BigDecimal prevClosingBalanceDebit;
/**
* 上月期末余额(贷方)
*/
@Schema(name = "prevClosingBalanceCredit", description = "上月期末余额(贷方)")
@TableField(fill = FieldFill.INSERT)
private BigDecimal prevClosingBalanceCredit;
/**
* 上月本年累计发生额(借方)
*/
@Schema(name = "prevYearToDateDebit", description = "上月本年累计发生额(借方)")
@TableField(fill = FieldFill.INSERT)
private BigDecimal prevYearToDateDebit;
/**
* 上月本年累计发生额(贷方)
*/
@Schema(name = "prevYearToDateCredit", description = "上月本年累计发生额(贷方)")
@TableField(fill = FieldFill.INSERT)
private BigDecimal prevYearToDateCredit;
/**
* 是否辅助核算项:n-否;y-是
*/

View File

@ -1,188 +0,0 @@
/*
* 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;
}

View File

@ -1,27 +0,0 @@
/*
* 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<StatementSubjectBalanceOpeningMapper, StatementSubjectBalanceOpening, StatementSubjectBalanceOpening> {
}

View File

@ -267,7 +267,16 @@ public class BookInitBalanceServiceImpl extends ServiceImpl<BookInitBalanceMappe
balance.setClosingBalanceCredit(balance.getOpeningBalanceCredit()
.subtract(balance.getOpeningBalanceDebit()));
}
//上月期末余额
balance.setPrevBalance(balance.getBalance());
//上月期末借贷余额
balance.setPrevClosingBalanceDebit(balance.getPrevClosingBalanceDebit());
balance.setPrevClosingBalanceCredit(balance.getPrevClosingBalanceCredit());
//上月期末年度累计
balance.setPrevYearToDateDebit(balance.getYearToDateDebit());
balance.setPrevYearToDateCredit(balance.getYearToDateCredit());
updateBalances.add(balance);
}
statementSubjectBalanceMapper.insertOrUpdateBatch(updateBalances);

View File

@ -31,7 +31,6 @@ 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;
@ -41,12 +40,10 @@ 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;
@ -70,7 +67,6 @@ 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,19 +450,21 @@ public class StatementSubjectBalanceServiceImpl implements StatementSubjectBalan
statementSubjectBalance.setYearToDateDebit(BigDecimal.ZERO);
statementSubjectBalance.setYearToDateCredit(BigDecimal.ZERO);
}
//上月期末余额
statementSubjectBalance.setPrevBalance(statementSubjectBalance.getBalance());
//上月期末借贷余额
statementSubjectBalance.setPrevClosingBalanceDebit(statementSubjectBalance.getPrevClosingBalanceDebit());
statementSubjectBalance.setPrevClosingBalanceCredit(statementSubjectBalance.getPrevClosingBalanceCredit());
//上月期末年度累计
statementSubjectBalance.setPrevYearToDateDebit(statementSubjectBalance.getYearToDateDebit());
statementSubjectBalance.setPrevYearToDateCredit(statementSubjectBalance.getYearToDateCredit());
//状态
statementSubjectBalance.setIsVoucher(YesNoEnum.n.name());
String currentId = identifierGenerator.nextId(statementSubjectBalance).toString();
statementSubjectBalance.setId(currentId);
}
subjectBalanceMapper.insertBatch(subjectBalanceList);
List<StatementSubjectBalanceOpening> subjectBalanceOpeningList = new ArrayList<>();
for( StatementSubjectBalance statementSubjectBalance: subjectBalanceList) {
StatementSubjectBalanceOpening statementSubjectBalanceOpening = new StatementSubjectBalanceOpening();
BeanUtil.copyProperties(statementSubjectBalance, statementSubjectBalanceOpening);
subjectBalanceOpeningList.add(statementSubjectBalanceOpening);
}
statementSubjectBalanceOpeningMapper.insertBatch(subjectBalanceOpeningList);
return true;
}

View File

@ -17,3 +17,13 @@ DROP TABLE `jinbooks`.`jbx_employee_salary_voucher_rule_template`, `jinbooks`.`j
ALTER TABLE `jinbooks`.`jbx_voucher_template`
ADD COLUMN `voucher_date` SMALLINT NULL DEFAULT 0 COMMENT '默认凭证日期为月份的第几天0为月末' AFTER `voucher_type`;
-- 上月数据
ALTER TABLE `jinbooks`.`jbx_statement_subject_balance`
ADD COLUMN `prev_balance` DECIMAL(18,2) NOT NULL DEFAULT '0.00' COMMENT '上月末余额' AFTER `closing_balance_credit`,
ADD COLUMN `prev_closing_balance_debit` DECIMAL(18,2) NOT NULL DEFAULT '0.00' COMMENT '上月期末余额(借方)' AFTER `prev_balance`,
ADD COLUMN `prev_closing_balance_credit` DECIMAL(18,2) NOT NULL DEFAULT '0.00' COMMENT '上月期末余额(贷方)' AFTER `prev_closing_balance_debit`,
ADD COLUMN `prev_year_to_date_debit` DECIMAL(18,2) NOT NULL DEFAULT '0.00' COMMENT '上月本年累计发生额(借方)' AFTER `prev_closing_balance_credit`,
ADD COLUMN `prev_year_to_date_credit` DECIMAL(18,2) NOT NULL DEFAULT '0.00' COMMENT '上月本年累计发生额(贷方)' AFTER `prev_year_to_date_debit`;