验证中...
BudgetAccountInfo.java
Raw Copy
package com.dongsport.common.model.ds1;
import java.util.List;
import java.io.Serializable;
import java.util.Date;
/**
* 预算科目维护
* @author 1
*
*/
public class BudgetAccountInfo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private Long id;
/**
* 科目编号
*/
private String accountNumber;
/**
* 科目名称
*/
private String accountName;
/**
* 上级科目
*/
private String supAccount;
/**
* 1:启动 0 停用
*/
private String status;
/**
* 科目说明
*/
private String accountDesc;
/**
* 汇算标记:1 按月编制,汇总 2 按月编制,不汇总\n
*/
private String budgetMark;
/**
* 0 否 1 是
*/
private String folderFlag;
/**
* 操作人
*/
private Long oprId;
/**
* opr_time
*/
private Date oprTime;
private String itemNumber;
private List<BudgetAccountInfo> children;
public BudgetAccountInfo() {
}
public BudgetAccountInfo(Long id, String accountNumber, String accountName, String supAccount, String status,
String accountDesc, String budgetMark, String folderFlag, Long oprId, Date oprTime, String itemNumber) {
super();
this.id = id;
this.accountNumber = accountNumber;
this.accountName = accountName;
this.supAccount = supAccount;
this.status = status;
this.accountDesc = accountDesc;
this.budgetMark = budgetMark;
this.folderFlag = folderFlag;
this.oprId = oprId;
this.oprTime = oprTime;
this.itemNumber = itemNumber;
}
public String getItemNumber() {
return itemNumber;
}
public void setItemNumber(String itemNumber) {
this.itemNumber = itemNumber;
}
public List<BudgetAccountInfo> getChildren() {
return children;
}
public void setChildren(List<BudgetAccountInfo> children) {
this.children = children;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAccountNumber() {
return accountNumber;
}
public void setAccountNumber(String accountNumber) {
this.accountNumber = accountNumber;
}
public String getAccountName() {
return accountName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
public String getSupAccount() {
return supAccount;
}
public void setSupAccount(String supAccount) {
this.supAccount = supAccount;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getAccountDesc() {
return accountDesc;
}
public void setAccountDesc(String accountDesc) {
this.accountDesc = accountDesc;
}
public String getBudgetMark() {
return budgetMark;
}
public void setBudgetMark(String budgetMark) {
this.budgetMark = budgetMark;
}
public String getFolderFlag() {
return folderFlag;
}
public void setFolderFlag(String folderFlag) {
this.folderFlag = folderFlag;
}
public Long getOprId() {
return oprId;
}
public void setOprId(Long oprId) {
this.oprId = oprId;
}
public Date getOprTime() {
return oprTime;
}
public void setOprTime(Date oprTime) {
this.oprTime = oprTime;
}
}
BudgetAccountInfoTree.java
Raw Copy
package com.dongsport.common.model.ds1;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
public class BudgetAccountInfoTree {
private List<BudgetAccountInfo> menuList=new ArrayList<BudgetAccountInfo>();
public BudgetAccountInfoTree(List<BudgetAccountInfo> menuList) {
super();
this.menuList = menuList;
}
//建立树形结构
public List<BudgetAccountInfo> builTree(){
List<BudgetAccountInfo> treeMenus =new ArrayList<BudgetAccountInfo>();
for(BudgetAccountInfo menuNode : getRootNode()) {
menuNode=buildChilTree(menuNode);
treeMenus.add(menuNode);
}
return treeMenus;
}
//递归,建立子树形结构
private BudgetAccountInfo buildChilTree(BudgetAccountInfo pNode){
List<BudgetAccountInfo> chilMenus =new ArrayList<BudgetAccountInfo>();
for(BudgetAccountInfo menuNode : menuList) {
if(menuNode.getSupAccount().equals(pNode.getAccountNumber())) {
chilMenus.add(buildChilTree(menuNode));
}
}
pNode.setChildren(chilMenus);
return pNode;
}
//获取根节点
private List<BudgetAccountInfo> getRootNode() {
List<BudgetAccountInfo> rootMenuLists =new ArrayList<BudgetAccountInfo>();
for(BudgetAccountInfo menuNode : menuList) {
if(StringUtils.isBlank(menuNode.getSupAccount())) {
rootMenuLists.add(menuNode);
}
}
return rootMenuLists;
}
}

Comment list( 0 )

You need to Sign in for post a comment

Help Search