| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.ruoyi.cwgl.enums.AccountingItemEnum; |
| | | import java.util.Date; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import lombok.Data; |
| | | /** |
| | | * 凭证科目设置对象 voucher_subject_setting |
| | |
| | | |
| | | @TableField("parent_id") |
| | | private Integer parentId; |
| | | |
| | | /** 上级科目代码 */ |
| | | @Excel(name = "上级科目代码") |
| | | |
| | | @TableField("parent_subject_code") |
| | | private String parentSubjectCode; |
| | | |
| | | /** 上级科目名称 */ |
| | | @Excel(name = "上级科目名称") |
| | | |
| | | @TableField("parent_subject_name") |
| | | private String parentSubjectName; |
| | | |
| | | |
| | | /** 祖级列表 */ |
| | |
| | | private String balanceDirection; |
| | | |
| | | |
| | | /** 核算项目 */ |
| | | /** 核算项目(位运算值) */ |
| | | @Excel(name = "核算项目") |
| | | |
| | | @TableField("accounting_items") |
| | | private String accountingItems; |
| | | private Integer accountingItems; |
| | | |
| | | |
| | | /** 数量金额核算(1是 0否) */ |
| | |
| | | @TableField("type") |
| | | private String type; |
| | | |
| | | /** 核算项目描述(非数据库字段) */ |
| | | @TableField(exist = false) |
| | | private String accountingItemsDesc; |
| | | |
| | | /** 核算项目列表(非数据库字段) */ |
| | | @TableField(exist = false) |
| | | private List<String> accountingItemList; |
| | | |
| | | /** 核算项目包含查询(非数据库字段) */ |
| | | @TableField(exist = false) |
| | | private Integer accountingItemsContains; |
| | | |
| | | /** 核算项目任意包含查询(非数据库字段) */ |
| | | @TableField(exist = false) |
| | | private Integer accountingItemsAny; |
| | | |
| | | /** |
| | | * 获取核算项目的描述字符串 |
| | | */ |
| | | public String getAccountingItemsDesc() { |
| | | if (accountingItems == null) { |
| | | return ""; |
| | | } |
| | | return AccountingItemEnum.getDescriptions(accountingItems); |
| | | } |
| | | |
| | | /** |
| | | * 设置核算项目描述字符串 |
| | | */ |
| | | public void setAccountingItemsDesc(String accountingItemsDesc) { |
| | | this.accountingItemsDesc = accountingItemsDesc; |
| | | if (accountingItemsDesc != null && !accountingItemsDesc.trim().isEmpty()) { |
| | | this.accountingItems = AccountingItemEnum.getValueByDescriptions(accountingItemsDesc); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取核算项目列表 |
| | | */ |
| | | public List<String> getAccountingItemList() { |
| | | if (accountingItems == null) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<String> list = new ArrayList<>(); |
| | | for (AccountingItemEnum item : AccountingItemEnum.values()) { |
| | | if (AccountingItemEnum.contains(accountingItems, item)) { |
| | | list.add(item.getDescription()); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 设置核算项目列表 |
| | | */ |
| | | public void setAccountingItemList(List<String> accountingItemList) { |
| | | this.accountingItemList = accountingItemList; |
| | | if (accountingItemList != null && !accountingItemList.isEmpty()) { |
| | | int value = 0; |
| | | for (String desc : accountingItemList) { |
| | | for (AccountingItemEnum item : AccountingItemEnum.values()) { |
| | | if (item.getDescription().equals(desc.trim())) { |
| | | value = AccountingItemEnum.addItem(value, item); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | this.accountingItems = value; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检查是否包含某个核算项目 |
| | | */ |
| | | public boolean containsAccountingItem(AccountingItemEnum item) { |
| | | if (accountingItems == null) { |
| | | return false; |
| | | } |
| | | return AccountingItemEnum.contains(accountingItems, item); |
| | | } |
| | | |
| | | /** |
| | | * 添加核算项目 |
| | | */ |
| | | public void addAccountingItem(AccountingItemEnum item) { |
| | | if (accountingItems == null) { |
| | | accountingItems = 0; |
| | | } |
| | | accountingItems = AccountingItemEnum.addItem(accountingItems, item); |
| | | } |
| | | |
| | | /** |
| | | * 移除核算项目 |
| | | */ |
| | | public void removeAccountingItem(AccountingItemEnum item) { |
| | | if (accountingItems != null) { |
| | | accountingItems = AccountingItemEnum.removeItem(accountingItems, item); |
| | | } |
| | | } |
| | | |
| | | } |