package com.concom.imports.bqitem.util;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.beanutils.BeanUtils;
import org.dom4j.Document;
import org.dom4j.Element;
import com.concom.imports.bqitem.conf.ProjectReflectConfig;
import com.concom.imports.bqitem.dto.BQItem;
import com.concom.imports.bqitem.dto.BQNormItem;
import com.concom.imports.bqitem.dto.BQResUsageItem;
import com.concom.imports.bqitem.dto.Branch;
import com.concom.imports.bqitem.dto.ProMatData;
import com.concom.imports.bqitem.dto.ProjectBranchList;
import com.concom.imports.bqitem.dto.ProjectList;
import com.concom.imports.bqitem.dto.ResourceItem;
import com.concom.imports.bqitem.dto.ResourceUsage;
import com.concom.lang.helper.StringHelper;
import com.concom.lang.helper.TimeHelper;
import com.concom.matsmart.tools.constant.Constant;
/**
* Projects格式xml解析类
*
* @author Caozhili
* @date 2015-07-29
*/
public class ProjectsBranchRead extends BaseRead<ProjectBranchList> {
private static final String ROOT_PROJECTS = "Projects";
private static final String PROJECTGROUP = "ProjectGroup";
private static final String PROJECTITEM = "ProjectItem";
private static final String BILLTABLE = "BillTable";
private static final String MEASURETABLE = "MeasureTable";
private static final String BRANCH = "Branch";
private static final String PROJECTCOSTS = "ProjectCosts";
private static final String COSTS = "Costs";
private static final String WORKCONTENT = "WorkContent";
private static final String BILL = "Bill";
private static final String NORM = "Norm";
private static final String RESOURCE = "Resource";
private static final String RESOURCEITEM = "ResourceItem";
private static final String RESELEMENTS = "ResElements";
private static final String RESELEMENTITEM = "ResElementItem";
private static final Field[] ProjectListFields = ProjectList.class.getDeclaredFields();
private static final Field[] ResourceItemFields = ResourceItem.class.getDeclaredFields();
private static final Field[] BranchFields = Branch.class.getDeclaredFields();
private static final Field[] BQItemFields = BQItem.class.getDeclaredFields();
private static final Field[] BQNormItemFields = BQNormItem.class.getDeclaredFields();
private static final Field[] BQResUsageItemFields = BQResUsageItem.class.getDeclaredFields();
private static final Field[] ResourceUsageFields = ResourceUsage.class.getDeclaredFields();
@Override
public List<ProjectBranchList> parserXml(Document doc) throws Exception {
totalCount = 0;
maxQualityNum = 0;
mat5Datas.clear();
matDatas.clear();
List<ProjectBranchList> result = null;
Element root = doc.getRootElement();
if (ROOT_PROJECTS.equals(root.getName())) {
List<Element> projectList = root.elements(PROJECTGROUP);
if (null == projectList || projectList.isEmpty()) {
return null;
}
result = new ArrayList<ProjectBranchList>();
for (int i = 0; i < projectList.size(); i++) {
List<ProjectBranchList> projectListItem = readProjectList(projectList.get(i));
if (null != projectListItem && !projectListItem.isEmpty()) {
result.addAll(projectListItem);
}
}
}
return result;
}
private List<ProjectBranchList> readProjectList(Element projectItemElement) throws Exception {
if (null == projectItemElement) {
return null;
}
List<ProjectBranchList> resultList = new ArrayList<ProjectBranchList>();
List<Element> projectItemList = projectItemElement.elements(PROJECTITEM);
if (null != projectItemList && !projectItemList.isEmpty()) {
// 递归调用
for (int i = 0; i < projectItemList.size(); i++) {
try {
ProjectBranchList projectList = readProjectListItem(projectItemList.get(i));
if (null != projectList) {
resultList.add(projectList);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
return resultList;
}
/**
* 读取分部项目
*
* @param projectListElement
* @return
* @throws Exception
*/
private ProjectBranchList readProjectListItem(Element projectListElement) throws Exception {
List<Element> BQTableElements = projectListElement.elements(BILLTABLE);
List<Element> BQTableElements2 = projectListElement.elements(MEASURETABLE);
if (null == BQTableElements || BQTableElements.isEmpty()) {
return null;
}
ProjectBranchList projectList = new ProjectBranchList();
boolean flag = parserElementAttrValue(projectList, projectListElement, ProjectListFields);
if (flag) {
Element projectCostsElement = projectListElement.element(PROJECTCOSTS);
flag = parserElementAttrValue(projectList, projectCostsElement, ProjectListFields);
}
if (!flag) {
return null;
}
List<Branch> branchList = new ArrayList<Branch>();
List<ResourceItem> ResourceItemList = new ArrayList<ResourceItem>();
//分部分项数据
for (Element table : BQTableElements) {
List<Branch> tempList = null;
List<Element> branchElements = table.elements(BRANCH);
if (null != branchElements && !branchElements.isEmpty()) {
tempList = readBQItem(branchElements);
} else {
tempList = readBQItem(BQTableElements);
}
if (null != tempList && !tempList.isEmpty()) {
branchList.addAll(tempList);
}
}
//措施项目
if (null != BQTableElements2 && !BQTableElements2.isEmpty()) {
for (Element table : BQTableElements2) {
List<Branch> tempList = null;
List<Element> branchElements = table.elements(BRANCH);
if (null != branchElements && !branchElements.isEmpty()) {
tempList = readBQItem(branchElements);
} else {
tempList = readBQItem(BQTableElements);
}
if (null != tempList && !tempList.isEmpty()) {
branchList.addAll(tempList);
}
}
}
Integer projectListID = projectList.getProjectListID();
//添加专业
addSpecialty(projectList.getSpeciality());
List<Element> ResourceElements = projectListElement.elements(RESOURCE);
if (null != ResourceElements && !ResourceElements.isEmpty()) {
List<ResourceItem> tempResourceItemList = readResourceItem(projectList,ResourceElements, projectListID);
if (null != tempResourceItemList && !tempResourceItemList.isEmpty()) {
ResourceItemList.addAll(tempResourceItemList);
}
}
projectList.setBranchList(branchList);
projectList.setResourceItemList(ResourceItemList);
return projectList;
}
/**
* 读取工料机
*
* @param ResourceElements
* @return
* @throws Exception
*/
private List<ResourceItem> readResourceItem(ProjectBranchList projectList,List<Element> ResourceElements, Integer projectListID)
throws Exception {
if (null == ResourceElements || ResourceElements.isEmpty()) {
return null;
}
List<ResourceItem> ResourceItemList = new ArrayList<ResourceItem>();
List<ProMatData> proMatDatas = new ArrayList<ProMatData>();
for (Element ResourceElement : ResourceElements) {
List<Element> ResourceItemElements = ResourceElement.elements(RESOURCEITEM);
if (null == ResourceItemElements || ResourceItemElements.isEmpty()) {
continue;
}
for (Element element : ResourceItemElements) {
// 解析ResourceItem
ResourceItem resourceItem = new ResourceItem();
boolean flag = parserElementAttrValue(resourceItem, element, ResourceItemFields);
Element resElements = element.element(RESELEMENTS);
if (null != resElements) {
List<Element> ResourceUsageElements = resElements.elements(RESELEMENTITEM);
if (null != ResourceUsageElements && !ResourceUsageElements.isEmpty()) {
List<ResourceUsage> ResourceUsageList = new ArrayList<ResourceUsage>();
for (Element ResourceUsageElement : ResourceUsageElements) {
// 解析ResourceUsage
ResourceUsage ResourceUsage = new ResourceUsage();
boolean flagResourceUsage = parserElementAttrValue(ResourceUsage, ResourceUsageElement,
ResourceUsageFields);
if (flagResourceUsage) {
ResourceUsageList.add(ResourceUsage);
}
}
resourceItem.setResourceUsageList(ResourceUsageList);
}
}
if (flag) {
totalCount++;
ProMatData matData = new ProMatData();
matData.setName(resourceItem.getName());
matData.setUnit(StringHelper.transforNull(resourceItem.getUnit()));
matData.setSpec(StringHelper.transforNull(resourceItem.getSpecification()));
// mat5Data.setCount(resourceItem.getQuantity().toString());
if (null == resourceItem.getQuantity() || resourceItem.getQuantity().equals(0d)) {
matData.setCount("1");
} else {
matData.setCount(resourceItem.getQuantity().toString());
}
matData.setPrice(resourceItem.getRate().toString());
matData.setAddr(StringHelper.transforNull(resourceItem.getProducingArea()));
matData.setIssueDate(TimeHelper.format(null, Constant.DEFAULT_FORMAT));
matData.setNote(StringHelper.transforNull(resourceItem.getRemark()));
matData.setResourceID(resourceItem.getResourceID().toString());
matData.setEname(StringHelper.transforNull(resourceItem.getSupplier()));
matData.setProjectListID(projectListID.toString());
proMatDatas.add(matData);
if (mat5Datas.size() < mat5DatasSize) {
ProMatData mat5Data = new ProMatData();
BeanUtils.copyProperties(mat5Data, matData);
mat5Datas.add(mat5Data);
}
ResourceItemList.add(resourceItem);
}
}
}
projectList.setMatDatas(proMatDatas);
return ResourceItemList;
}
private List<Branch> readBQItem(List<Element> branchElements) throws Exception {
if (null == branchElements || branchElements.isEmpty()) {
return null;
}
List<Branch> BranchList = new ArrayList<Branch>();
for (Element branchElement : branchElements) {
List<Element> branchElements2 = branchElement.elements(BRANCH);
if (null != branchElements2 && !branchElements2.isEmpty()) {
BranchList.addAll(readBQItem(branchElements2));
continue;
}
List<Element> billElements = branchElement.elements(BILL);
if (null == billElements || billElements.isEmpty()) {
continue;
}
Branch branch = new Branch();
List<BQItem> BQItemList = new ArrayList<BQItem>();
boolean flag1 = parserElementAttrValue(branch, branchElement, BranchFields);
if (flag1) {
Element branchCost = branchElement.element(COSTS);
if (null != branchCost) {
parserElementAttrValue(branch, branchCost, BranchFields);
}
}
for (Element billElement : billElements) {
if (null == billElement) {
continue;
}
List<BQNormItem> BQNormItemList = new ArrayList<BQNormItem>();
// 解析BQItem
BQItem bqItem = new BQItem();
boolean flag = parserElementAttrValue(bqItem, billElement, BQItemFields);
if (flag) {
Element costElement = billElement.element(COSTS);
if (null != costElement) {
parserElementAttrValue(bqItem, costElement, BQItemFields);
}
}
List<Element> WorkContents = billElement.elements(WORKCONTENT);
// .element(RESELEMENTS);
if (null != WorkContents) {
for (Element workContentElement : WorkContents) {
List<Element> normElements = workContentElement.elements(NORM);
if (null == normElements) {
continue;
}
for (Element normElement : normElements) {
if (null == normElement) {
continue;
}
Map<String,BQResUsageItem> BQResUsageItemMap = new HashMap<String,BQResUsageItem>();
// 解析BQNormItem
BQNormItem bqNormItem = new BQNormItem();
boolean flagBQNormItem = parserElementAttrValue(bqNormItem, normElement, BQNormItemFields);
if (flagBQNormItem) {
Element normCostElement = normElement.element(COSTS);
if (null != normCostElement) {
parserElementAttrValue(bqNormItem, normCostElement, BQNormItemFields);
}
}
Element resElementsElement = normElement.element(RESELEMENTS);
if (null == resElementsElement) {
continue;
}
List<Element> resElementItems = resElementsElement.elements(RESELEMENTITEM);
if (null != resElementItems && !resElementItems.isEmpty()) {
for (Element resElementItemElement : resElementItems) {
// 解析BQResUsageItem
BQResUsageItem BQResUsageItem = new BQResUsageItem();
boolean flagBQResUsageItem = parserElementAttrValue(BQResUsageItem,
resElementItemElement, BQResUsageItemFields);
if (flagBQResUsageItem) {
String resourceID = BQResUsageItem.getResourceID();
if(null!=resourceID && !"".equals(resourceID)){
if (BQResUsageItemMap.containsKey(resourceID)) {
BQResUsageItem beforeUsageItem = BQResUsageItemMap.get(resourceID);
beforeUsageItem.setUsage(BQResUsageItem.getUsage()+beforeUsageItem.getUsage());
BQResUsageItemMap.put(resourceID, beforeUsageItem);
}else{
BQResUsageItemMap.put(resourceID, BQResUsageItem);
}
}
}
}
}
// 转成list
List<BQResUsageItem> BQResUsageItemList = new ArrayList<BQResUsageItem>();
Iterator<String> usageItr = BQResUsageItemMap.keySet().iterator();
while(usageItr.hasNext()){
String resourceID = usageItr.next();
BQResUsageItemList.add(BQResUsageItemMap.get(resourceID));
}
bqNormItem.setBQResUsageItemList(BQResUsageItemList);
if (flagBQNormItem) {
BQNormItemList.add(bqNormItem);
}
}
}
}
bqItem.setBQNormItemList(BQNormItemList);
if (flag) {
BQItemList.add(bqItem);
}
}
if (flag1) {
branch.setBQItemList(BQItemList);
BranchList.add(branch);
}
}
return BranchList;
}
@Override
public String getAttrName(Object obj, String attrName) throws Exception {
if (null == attrName) {
return "";
}
if (obj instanceof BQItem) {
attrName = ProjectReflectConfig.getBillMap(attrName);
} else if (obj instanceof BQNormItem) {
attrName = ProjectReflectConfig.getNormMap(attrName);
} else if (obj instanceof ProjectBranchList) {
attrName = ProjectReflectConfig.getProjectItemMap(attrName);
} else if (obj instanceof ResourceItem) {
attrName = ProjectReflectConfig.getResourceMap(attrName);
} else if (obj instanceof ResourceUsage || obj instanceof BQResUsageItem) {
attrName = ProjectReflectConfig.getResourceUsageMap(attrName);
}
return attrName.trim();
}
}
BaseRead.java
package com.concom.imports.bqitem.util;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.Element;
import com.concom.imports.bqitem.dto.BQItem;
import com.concom.imports.bqitem.dto.ProMatData;
import com.concom.imports.bqitem.dto.ResourceItem;
import com.concom.imports.utils.DoubleUtil;
/**
* 工程分部分项数据基础类
* @author Caozhili
* @date 2015-07-29
*/
public abstract class BaseRead<T> {
/**
* 小数点位数
*/
protected static final int SCALE = 2;
/**
* 单价小数点位数
*/
protected static final int RATE_SCALE = 4;
/**
* 误差范围
*/
protected static final double percentNum = 0.01;
/**
* 预览材价条数
*/
protected static final int mat5DatasSize = 5;
/**
* 材价总数
*/
protected int totalCount = 0;
private int reCountNum = 0;
/**
* 前五条材价数据
*/
protected List<ProMatData> mat5Datas = new ArrayList<ProMatData>();
/**
* 所有材价数据
*/
protected List<ProMatData> matDatas = new ArrayList<ProMatData>();
/**
* 匹配到的最大非空属性数量
*/
protected int maxQualityNum = 0;
/**
* 专业
*/
private Set<Integer> specialtySet = new HashSet<Integer>();
/**
* 解析xml
* @param doc
* @return
* @throws Exception
*/
public abstract List<T> parserXml(Document doc) throws Exception;
/**
* 获取属性名称
* @param obj
* @param attrName
* @return
* @throws Exception
*/
public abstract String getAttrName(Object obj,String attrName) throws Exception;
/**
* 根据借点属性设置对象属性值
* @param bean
* @param element
* @param fields
* @return
* @throws Exception
*/
protected boolean parserElementAttrValue(Object bean,Element element,Field[] fields)throws Exception{
if(null==element){
return false;
}
List<Attribute> attrElements = element.attributes();
if(null==attrElements || attrElements.isEmpty()){
return false;
}
int qualityNum = 0;
for (Attribute attr:attrElements) {
String attrName = attr.getName();
if(null==attrName || "".equals(attrName)){
continue;
}
attrName = getAttrName(bean,attrName);
for (Field field:fields) {
String name = field.getName();
if(attrName.equalsIgnoreCase(name)){
//赋值
String attrValue = attr.getValue();
if(bean instanceof ResourceItem){
if(attrValue!=null && !"".equals(attrValue.trim())){
qualityNum++;
}
}
Object type = field.getType();
setBeanValue(bean, name, type, attrValue);
}
}
}
if(qualityNum>maxQualityNum){
maxQualityNum = qualityNum;
}
return true;
}
/**
* 反射设置对象值
* @param bean
* @param name
* @param type
* @param tempVal
* @throws Exception
*/
protected void setBeanValue(Object bean,String name,Object type,String tempVal) throws Exception{
String methodName = getMethodName(name);
if(type == Double.class){
if(null!=tempVal && !"".equals(tempVal)){
if(tempVal.contains("%")){
tempVal = tempVal.replaceAll("%", "");
}
bean.getClass().getMethod(methodName,Double.class).invoke(bean,DoubleUtil.round(Double.valueOf(tempVal),8));
}else{
bean.getClass().getMethod(methodName,Double.class).invoke(bean, 0d);
}
}else if(type == Integer.class){
if(null!=tempVal && !"".equals(tempVal)){
if(tempVal.contains("%")){
tempVal = tempVal.replaceAll("%", "");
}
bean.getClass().getMethod(methodName,Integer.class).invoke(bean, Integer.valueOf(tempVal));
}else{
bean.getClass().getMethod(methodName,Integer.class).invoke(bean, 0);
}
}else if(type == Boolean.class){
if(null!=tempVal && !"".equals(tempVal)){
bean.getClass().getMethod(methodName,Boolean.class).invoke(bean, Boolean.valueOf(tempVal));
}else{
bean.getClass().getMethod(methodName,Boolean.class).invoke(bean, false);
}
}else{
if(null!=tempVal){
bean.getClass().getMethod(methodName,String.class).invoke(bean, tempVal.trim());
}else{
bean.getClass().getMethod(methodName,String.class).invoke(bean, "");
}
}
}
/**
* 从新计算价格
* @param bqItem
*/
protected void reCountBQItemRate(BQItem bqItem) {
//单价计算方式(人工费+材料费+机械费+管理费+利润)
try{
double rate = bqItem.getLaborRate()+bqItem.getMaterialRate()+bqItem.getMachineRate()
+bqItem.getProfitRate()+bqItem.getOverheadRate()+bqItem.getRestRate();
double quantity = bqItem.getQuantity();
if(quantity==1d){
reCountNum++;
return;
}
if(Math.abs(DoubleUtil.sub(bqItem.getAddup(), rate*quantity))<1){
return;
}
if(quantity>0 && Math.abs((1-Math.abs(rate/bqItem.getAddup())))<percentNum){
reCountNum++;
//重新计算单价
bqItem.setLaborRate(DoubleUtil.round(bqItem.getLaborRate()/quantity,SCALE));
bqItem.setMaterialRate(DoubleUtil.round(bqItem.getMaterialRate()/quantity,SCALE));
bqItem.setMachineRate(DoubleUtil.round(bqItem.getMachineRate()/quantity,SCALE));
bqItem.setProfitRate(DoubleUtil.round(bqItem.getProfitRate()/quantity,SCALE));
bqItem.setOverheadRate(DoubleUtil.round(bqItem.getOverheadRate()/quantity,SCALE));
bqItem.setRestRate(DoubleUtil.round(bqItem.getRestRate()/quantity,SCALE));
bqItem.setRiskRate(DoubleUtil.round(bqItem.getRiskRate()/quantity,SCALE));
bqItem.setMainMaterialRate(DoubleUtil.round(bqItem.getMainMaterialRate()/quantity,SCALE));
bqItem.setEquipmentRate(DoubleUtil.round(bqItem.getEquipmentRate()/quantity,SCALE));
}
}catch(Exception e){
e.printStackTrace();
}
}
/**
* 添加专业
* @param specialty
*/
protected void addSpecialty(Integer specialty){
if(null==specialty){
return;
}
if(!specialtySet.contains(specialty)){
specialtySet.add(specialty);
}
}
/**
* 获取属性get方法
* @param fieldName
* @return
*/
protected String getMethodName(String fieldName){
String firstChar = fieldName.charAt(0)+"";
return "set"+firstChar.toUpperCase()+fieldName.substring(1);
}
public List<ProMatData> getMat5Datas() {
return mat5Datas;
}
public List<ProMatData> getMatDatas() {
return matDatas;
}
public int getTotalCount() {
return totalCount;
}
public int getMaxQualityNum() {
return maxQualityNum;
}
public int getReCountNum() {
return reCountNum;
}
public Set<Integer> getSpecialtySet() {
return specialtySet;
}
}
ProjectBranchList.java
package com.concom.imports.bqitem.dto;
import java.util.ArrayList;
import java.util.List;
/**
* @Title: ProjectBranchList.java
* @Package com.concom.imports.bqitem.dto
* @Description: 工程结构实体类
* @author CaoZhili
* @date 2015年9月6日 上午10:22:01
* @version V1.0
*/
public class ProjectBranchList implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private Integer projectListID;
private String name;
private Integer projectType;
private Integer speciality;
private Double BQItemCost;
private Double measureItemCost;
private Double otherItemCost;
private Double lawfeeTotal;
private Double taxTotal;
private Double laborTotal;
private Double materialTotal;
private Double machineTotal;
private Double overheadTotal;
private Double profitTotal;
private Double total;
private Integer professionalTreeId;
private List<Branch> BranchList;
private List<ResourceItem> ResourceItemList;
/**
* 单项工程材价数据
*/
private List<ProMatData> matDatas;
public Integer getProjectListID() {
return projectListID;
}
public void setProjectListID(Integer projectListID) {
this.projectListID = projectListID;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getProjectType() {
return projectType;
}
public void setProjectType(Integer projectType) {
this.projectType = projectType;
}
public Integer getSpeciality() {
return speciality;
}
public void setSpeciality(Integer speciality) {
this.speciality = speciality;
}
public Double getBQItemCost() {
return BQItemCost;
}
public void setBQItemCost(Double bQItemCost) {
BQItemCost = bQItemCost;
}
public Double getMeasureItemCost() {
return measureItemCost;
}
public void setMeasureItemCost(Double measureItemCost) {
this.measureItemCost = measureItemCost;
}
public Double getOtherItemCost() {
return otherItemCost;
}
public void setOtherItemCost(Double otherItemCost) {
this.otherItemCost = otherItemCost;
}
public Double getLawfeeTotal() {
return lawfeeTotal;
}
public void setLawfeeTotal(Double lawfeeTotal) {
this.lawfeeTotal = lawfeeTotal;
}
public Double getTaxTotal() {
return taxTotal;
}
public void setTaxTotal(Double taxTotal) {
this.taxTotal = taxTotal;
}
public Double getLaborTotal() {
return laborTotal;
}
public void setLaborTotal(Double laborTotal) {
this.laborTotal = laborTotal;
}
public Double getMaterialTotal() {
return materialTotal;
}
public void setMaterialTotal(Double materialTotal) {
this.materialTotal = materialTotal;
}
public Double getMachineTotal() {
return machineTotal;
}
public void setMachineTotal(Double machineTotal) {
this.machineTotal = machineTotal;
}
public Double getOverheadTotal() {
return overheadTotal;
}
public void setOverheadTotal(Double overheadTotal) {
this.overheadTotal = overheadTotal;
}
public Double getProfitTotal() {
return profitTotal;
}
public void setProfitTotal(Double profitTotal) {
this.profitTotal = profitTotal;
}
public Double getTotal() {
return total;
}
public void setTotal(Double total) {
this.total = total;
}
public List<Branch> getBranchList() {
return BranchList;
}
public void setBranchList(List<Branch> branchList) {
BranchList = branchList;
}
public List<ResourceItem> getResourceItemList() {
return ResourceItemList;
}
public void setResourceItemList(List<ResourceItem> resourceItemList) {
ResourceItemList = resourceItemList;
}
public Integer getProfessionalTreeId() {
return professionalTreeId;
}
public void setProfessionalTreeId(Integer professionalTreeId) {
this.professionalTreeId = professionalTreeId;
}
public List<ProMatData> getMatDatas() {
return matDatas;
}
public void setMatDatas(List<ProMatData> matDatas) {
this.matDatas = matDatas;
}
}
Branch.java
package com.concom.imports.bqitem.dto;
import java.util.List;
/**
* @Title: Branch.java
* @Package com.concom.imports.bqitem.dto
* @Description: 分布实体
* @author CaoZhili
* @date 2015年9月6日 上午9:49:58
* @version V1.0
*/
public class Branch implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String code;
private String name;
private String remark;
private Double total;
private Double labor;//人工费
private Double material;//材料费
private Double mainMaterial;//主材费
private Double equipment;//设备费
private Double machine;//机械费
private Double overhead;//管理费
private Double lawfee;//规费
private Double tax;//税金
private Double profit;//利润
private Double riskCost;//风险费
private Double appraisal;//暂估价
private List<BQItem> BQItemList;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Double getTotal() {
return total;
}
public void setTotal(Double total) {
this.total = total;
}
public List<BQItem> getBQItemList() {
return BQItemList;
}
public void setBQItemList(List<BQItem> bQItemList) {
BQItemList = bQItemList;
}
public Double getLabor() {
return labor;
}
public void setLabor(Double labor) {
this.labor = labor;
}
public Double getMaterial() {
return material;
}
public void setMaterial(Double material) {
this.material = material;
}
public Double getMainMaterial() {
return mainMaterial;
}
public void setMainMaterial(Double mainMaterial) {
this.mainMaterial = mainMaterial;
}
public Double getEquipment() {
return equipment;
}
public void setEquipment(Double equipment) {
this.equipment = equipment;
}
public Double getMachine() {
return machine;
}
public void setMachine(Double machine) {
this.machine = machine;
}
public Double getOverhead() {
return overhead;
}
public void setOverhead(Double overhead) {
this.overhead = overhead;
}
public Double getLawfee() {
return lawfee;
}
public void setLawfee(Double lawfee) {
this.lawfee = lawfee;
}
public Double getTax() {
return tax;
}
public void setTax(Double tax) {
this.tax = tax;
}
public Double getProfit() {
return profit;
}
public void setProfit(Double profit) {
this.profit = profit;
}
public Double getRiskCost() {
return riskCost;
}
public void setRiskCost(Double riskCost) {
this.riskCost = riskCost;
}
public Double getAppraisal() {
return appraisal;
}
public void setAppraisal(Double appraisal) {
this.appraisal = appraisal;
}
}
BQItem.java
package com.concom.imports.bqitem.dto;
import java.util.List;
/**
* @author Cao Zhili
* @date 2015年5月20日
*/
public class BQItem implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private Integer BQItemID;
private String code;
private String name;
private String attr;
private String projectContent;
private String unit;
private Double quantity;
private Double rate;
private Double limitedRate;
private Double laborRate;
private Double materialRate;
private Double mainMaterialRate;
private Double equipmentRate;
private Double machineRate;
private Double restRate;
private Double overheadRate;
private Double profitRate;
private Double riskRate;
private Double lawfeeRate;
private Double taxRate;
private Double temporaryRate;
private Double addup;
private Boolean mainBQItem;
private String remark;
private List<BQNormItem> BQNormItemList;
public Integer getBQItemID() {
return BQItemID;
}
public void setBQItemID(Integer bQItemID) {
BQItemID = bQItemID;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAttr() {
return attr;
}
public void setAttr(String attr) {
this.attr = attr;
}
public String getProjectContent() {
return projectContent;
}
public void setProjectContent(String projectContent) {
this.projectContent = projectContent;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public Double getQuantity() {
if(null==quantity){
quantity = 0d;
}
return quantity;
}
public void setQuantity(Double quantity) {
this.quantity = quantity;
}
public Double getRate() {
if(null==rate){
rate = 0d;
}
return rate;
}
public void setRate(Double rate) {
this.rate = rate;
}
public Double getLimitedRate() {
return limitedRate;
}
public void setLimitedRate(Double limitedRate) {
this.limitedRate = limitedRate;
}
public Double getLaborRate() {
if(null==laborRate){
laborRate = 0d;
}
return laborRate;
}
public void setLaborRate(Double laborRate) {
this.laborRate = laborRate;
}
public Double getMaterialRate() {
if(null==materialRate){
materialRate = 0d;
}
return materialRate;
}
public void setMaterialRate(Double materialRate) {
this.materialRate = materialRate;
}
public Double getMainMaterialRate() {
if(null==mainMaterialRate){
mainMaterialRate = 0d;
}
return mainMaterialRate;
}
public void setMainMaterialRate(Double mainMaterialRate) {
this.mainMaterialRate = mainMaterialRate;
}
public Double getEquipmentRate() {
if(null==equipmentRate){
equipmentRate = 0d;
}
return equipmentRate;
}
public void setEquipmentRate(Double equipmentRate) {
this.equipmentRate = equipmentRate;
}
public Double getMachineRate() {
if(null==machineRate){
machineRate = 0d;
}
return machineRate;
}
public void setMachineRate(Double machineRate) {
this.machineRate = machineRate;
}
public Double getRestRate() {
if(null==restRate){
restRate = 0d;
}
return restRate;
}
public void setRestRate(Double restRate) {
this.restRate = restRate;
}
public Double getOverheadRate() {
if(null==overheadRate){
overheadRate = 0d;
}
return overheadRate;
}
public void setOverheadRate(Double overheadRate) {
this.overheadRate = overheadRate;
}
public Double getProfitRate() {
if(null==profitRate){
profitRate = 0d;
}
return profitRate;
}
public void setProfitRate(Double profitRate) {
this.profitRate = profitRate;
}
public Double getRiskRate() {
if(null==riskRate){
riskRate = 0d;
}
return riskRate;
}
public void setRiskRate(Double riskRate) {
this.riskRate = riskRate;
}
public Double getLawfeeRate() {
return lawfeeRate;
}
public void setLawfeeRate(Double lawfeeRate) {
this.lawfeeRate = lawfeeRate;
}
public Double getTaxRate() {
return taxRate;
}
public void setTaxRate(Double taxRate) {
this.taxRate = taxRate;
}
public Double getTemporaryRate() {
return temporaryRate;
}
public void setTemporaryRate(Double temporaryRate) {
this.temporaryRate = temporaryRate;
}
public Double getAddup() {
if(null==addup){
addup = 0d;
}
return addup;
}
public void setAddup(Double addup) {
this.addup = addup;
}
public Boolean getMainBQItem() {
return mainBQItem;
}
public void setMainBQItem(Boolean mainBQItem) {
this.mainBQItem = mainBQItem;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public List<BQNormItem> getBQNormItemList() {
return BQNormItemList;
}
public void setBQNormItemList(List<BQNormItem> bQNormItemList) {
BQNormItemList = bQNormItemList;
}
}
ResourceItem.java
package com.concom.imports.bqitem.dto;
import java.util.List;
/**
* @author Cao Zhili
* @date 2015年5月20日
*/
public class ResourceItem implements java.io.Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
private String resourceID;
private String code;
private String name;
private String specification;
private String unit;
private Double rate;
private Double quantity;
private Double addup;
private Integer costKind;
private Boolean mainMaterialFlag;
private String remark;
private String producingArea;
private String supplier;
private Integer provider;
private String materialTemporaryCode;
private List<ResourceUsage> ResourceUsageList;
public String getResourceID() {
return resourceID;
}
public void setResourceID(String resourceID) {
this.resourceID = resourceID;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSpecification() {
return specification;
}
public void setSpecification(String specification) {
this.specification = specification;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public Double getRate() {
if(null==rate){
rate = 0d;
}
return rate;
}
public void setRate(Double rate) {
this.rate = rate;
}
public Double getQuantity() {
return quantity;
}
public void setQuantity(Double quantity) {
this.quantity = quantity;
}
public Double getAddup() {
return addup;
}
public void setAddup(Double addup) {
this.addup = addup;
}
public Integer getCostKind() {
return costKind;
}
public void setCostKind(Integer costKind) {
this.costKind = costKind;
}
public Boolean getMainMaterialFlag() {
return mainMaterialFlag;
}
public void setMainMaterialFlag(Boolean mainMaterialFlag) {
this.mainMaterialFlag = mainMaterialFlag;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public String getProducingArea() {
return producingArea;
}
public void setProducingArea(String producingArea) {
this.producingArea = producingArea;
}
public String getSupplier() {
return supplier;
}
public void setSupplier(String supplier) {
this.supplier = supplier;
}
public Integer getProvider() {
return provider;
}
public void setProvider(Integer provider) {
this.provider = provider;
}
public String getMaterialTemporaryCode() {
return materialTemporaryCode;
}
public void setMaterialTemporaryCode(String materialTemporaryCode) {
this.materialTemporaryCode = materialTemporaryCode;
}
public List<ResourceUsage> getResourceUsageList() {
return ResourceUsageList;
}
public void setResourceUsageList(List<ResourceUsage> resourceUsageList) {
ResourceUsageList = resourceUsageList;
}
}
ResourceUsage.java
package com.concom.imports.bqitem.dto;
/**
* @author Cao Zhili
* @date 2015年5月20日
*/
public class ResourceUsage implements java.io.Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
private String resourceID;
private Double usage;
public String getResourceID() {
return resourceID;
}
public void setResourceID(String resourceID) {
this.resourceID = resourceID;
}
public Double getUsage() {
return usage;
}
public void setUsage(Double usage) {
this.usage = usage;
}
}