- 浏览: 18126 次
- 性别:
- 来自: 广州
最新评论
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; } }
相关推荐
**DOM4J——XML解析库详解** XML(eXtensible Markup Language)作为一种标记语言,广泛应用于数据交换、配置文件和文档存储等领域。在Java环境中,解析XML文档时,我们通常会遇到各种库,其中DOM4J是一个非常流行...
dom4j负责解析、构建和修改XML文档,而jaxen则作为XPath查询工具,两者结合可以高效地处理复杂的XML操作。在实际项目中,掌握这两个库的使用能极大地提高XML处理的效率和灵活性。通过实践"xml practice"中的例子,你...
DOM解析会将整个XML文档加载到内存中形成一棵树形结构,方便访问任意节点,但内存消耗大;SAX解析则采用事件驱动,逐行读取XML,适合处理大型文档,但不支持随机访问。 三、DOM4J解析XML 1. 创建Document对象:使用...
DOM4J是一个强大的Java库,用于处理XML文档,包括读取、写入、修改和解析。本篇文章将深入探讨如何利用DOM4J解析SOAP消息中的元素,以便在实际项目中进行有效的数据提取和操作。 首先,理解SOAP消息的结构至关重要...
DOM4J是一个强大的Java库,专门用于处理XML文档。它提供了简单且灵活的API,使得XML解析、...这只是一个简单的例子,DOM4J库还提供了更高级的功能,如XPath查询、事件驱动的处理模式等,可以满足更复杂的XML处理需求。
DOM4J的版本迭代带来了许多改进和新特性,例如从1.6.1到2.1.1的过程中,可能包含了性能优化、API调整、错误修复和新的XML标准支持等。每个版本更新都致力于提高稳定性和易用性,满足开发者不断变化的需求。 在项目...
**Dom4j解析XML+使用简介** Dom4j是一个非常流行的Java库,专门用于处理XML文档,它提供了灵活且高效的方式来解析、创建和操作XML内容。这个库在XML处理领域中备受推崇,因为它简单易用,同时又具有高度的灵活性和...
在Java中,Dom4J是一个流行的库,它提供了方便的API来解析和操作XML文档。本篇文章将深入探讨Dom4J库如何解析XML源代码,并介绍其在创建XML文件时的应用。 首先,让我们了解什么是DOM(Document Object Model)。...
DOM4J与JDOM、SAX、StAX等其他XML解析器相比,DOM4J提供了更丰富的功能,如XPath支持、XML Schema处理和事件驱动的解析模式。它既适合大型文档的处理,也适用于内存有限的环境。然而,对于非常大的XML文档,可能需要...
DOM4J是一个强大的Java库,专门用于处理XML文档,它提供了灵活且高效的API来解析、创建、修改XML结构。在本文中,我们将深入探讨如何使用DOM4J解析XML和SOAP报文,以及如何从中提取所需字段。 首先,理解XML是非常...
在本教程中,我们将深入探讨如何使用DOM4J解析XML配置文件,并模拟处理`web.xml`中的`url-pattern`元素。 首先,让我们了解DOM4J的基本概念。DOM4J是一个基于Java的DOM模型的XML库,它扩展了标准的DOM API,增加了...
DOM4J是Java中一个非常优秀的XML处理库,它提供了丰富的API,使得操作XML文件变得简单而高效。在本文中,我们将详细探讨如何利用DOM4J库来读取XML文件。 1. **安装DOM4J** 要使用DOM4J,首先需要将其添加到你的...
XML解析方法主要有四种:DOM(文档对象模型)、SAX(简单API for XML)、StAX(流式API for XML)以及DOM4J。每种方法都有其特定的优势和适用场景。 1. DOM解析: DOM解析器将整个XML文档加载到内存中,形成一个树...
3. **遍历XML结构**:DOM4J提供迭代器和选择器来遍历XML结构。例如,`NodeList`和`ElementList`可以用于按顺序访问节点,而XPath表达式(如`//element[@attribute='value']`)则能定位到指定位置的元素。 4. **修改...
总结,DOM4J提供了一种面向对象的方式来解析和操作XML,其强大的功能包括解析XML文件、访问元素和属性、遍历结构、使用XPath查询以及通过递归处理复杂的XML结构。熟练掌握DOM4J,能够极大地提高处理XML文档的效率和...
**标题解析:** "Dom4J解析XML" 这个标题明确指出了我们要讨论的核心技术——使用Dom4J库来解析XML文档。Dom4J是一个Java库,它提供了丰富的API来处理XML,包括读取、写入、修改以及查询XML文档。在本文中,我们将...
这个“dom4j解析xml例子”压缩包应该包含了一些示例代码、帮助文档和使用说明,旨在帮助初学者快速理解和应用DOM4J。 在XML解析领域,DOM(Document Object Model)是一种将XML文档转换为内存对象树的方法。DOM4J是...
3. **遍历元素**:使用XPath或DOM4J提供的迭代器遍历XML文档中的元素。例如,遍历所有的`package`元素: ```java List<Element> packageElements = rootElement.elements("package"); for (Element ...
DOM4J是一个强大的Java库,专门用于处理XML文档。它提供了灵活且高效的API,使得XML的解析、创建、修改和查询变得简单。在处理大文件时,DOM4J结合XPath的使用,可以有效地管理和分析大量数据。在这个场景下,描述...