diff --git a/OBE-COMMON/src/com/gx/obe/thread/ImportTenderProjectThread.java b/OBE-COMMON/src/com/gx/obe/thread/ImportTenderProjectThread.java index 163f9f7a77e41a4528288b0e734b6577e95bd7fb..48d99b30325b2f3baa1ac7a737c9d03f93641e93 100644 --- a/OBE-COMMON/src/com/gx/obe/thread/ImportTenderProjectThread.java +++ b/OBE-COMMON/src/com/gx/obe/thread/ImportTenderProjectThread.java @@ -396,7 +396,6 @@ public class ImportTenderProjectThread implements Runnable { try { List<EvaluationFactor> evaluationFactorList = ParsingXmlUtils.analyELementXMl(element, childProject); if (null != evaluationFactorList && evaluationFactorList.size() > 0) { - evaluationFactorList = changeFactorList(evaluationFactorList, tenderProjectEntity); if(evaluationFactorService.saveDownloadEvaluationFactor(tenderProjectEntity.getId(), evaluationFactorList) > 0){ callBackMsg(true, evaluationFactorList.size() +"ä¸ªè¯„å®¡æŒ‡æ ‡å¯¼å…¥æˆåŠŸï¼"); } else { @@ -415,7 +414,6 @@ public class ImportTenderProjectThread implements Runnable { try { List<EvaluationFactor> evaluationFactorList = ParsingXmlUtils.analyELementXMl((Element)packEvalFactorList.get(0), tenderProjectEntity); if (null != evaluationFactorList && evaluationFactorList.size() > 0) { - evaluationFactorList = changeFactorList(evaluationFactorList, tenderProjectEntity); if(evaluationFactorService.saveDownloadEvaluationFactor(tenderProjectEntity.getId(), evaluationFactorList) > 0){ callBackMsg(true, evaluationFactorList.size() +"ä¸ªè¯„å®¡æŒ‡æ ‡å¯¼å…¥æˆåŠŸï¼"); } else { @@ -431,34 +429,6 @@ public class ImportTenderProjectThread implements Runnable { tenderProjectService.updateAssignProperty(tenderProjectEntity, new String[] { "id","isPack" }); } - private List<EvaluationFactor> changeFactorList(List<EvaluationFactor> evalFactorList, TenderProjectEntity tenderProjectEntity){ - BidPriceService bidPriceService = new BidPriceService(); - String TAX = "bidPrice"; - String NO_TAX = "noTaxBidPrice"; - List<BidPrice> bidPriceList = bidPriceService.getBidPriceFactorList(tenderProjectEntity.getId()); - if(null != bidPriceList && bidPriceList.size() > 0){ - return evalFactorList = evalFactorList.stream().map(t -> { - if(BidPrice.BID_PRICE_TOTAL_CODE.equals(t.getBidPriceCode())) { - t.setBidPriceCode(bidPriceList.get(0).getBidPriceCode()); - }else if(TAX.equals(t.getBidPriceCode()) || NO_TAX.equals(t.getBidPriceCode())){ - String tax; - if(TAX.equals(t.getBidPriceCode())) { - tax = "TAX_TOTAL_PRICE"; - }else { - tax = "NO_TAX_TOTAL_PRICE"; - } - BidPrice bidPriceResult = CollectionUtils.get(bidPriceList, s -> { - return tax.equals(s.getBidPriceCode()); - }); - if(bidPriceResult != null){ - t.setBidPriceCode(bidPriceResult.getBidPriceCode()); - } - } - return t; - }).collect(Collectors.toList()); - } - return evalFactorList; - } private void callBackMsg(String msg){ if(null != callBack){ callBack.callBackString(" "+ msg); diff --git a/OBE-COMMON/src/com/gx/obe/thread/NewDownloadEvaluationFactorThread.java b/OBE-COMMON/src/com/gx/obe/thread/NewDownloadEvaluationFactorThread.java index 80e69b39e7be98e6e3344ad4120b09ff6e278588..44c8e6fd58e8b5e163bf7c1eeadd1f56ffde3ccb 100644 --- a/OBE-COMMON/src/com/gx/obe/thread/NewDownloadEvaluationFactorThread.java +++ b/OBE-COMMON/src/com/gx/obe/thread/NewDownloadEvaluationFactorThread.java @@ -129,31 +129,6 @@ public class NewDownloadEvaluationFactorThread extends MyThread{ } if(null != evalFactorList && evalFactorList.size() > 0){ - BidPriceService bidPriceService = new BidPriceService(); - String TAX = "bidPrice"; - String NO_TAX = "noTaxBidPrice"; - List<BidPrice> bidPriceList = bidPriceService.getBidPriceFactorList(tenderProjectEntity.getId()); - if(null != bidPriceList && bidPriceList.size() > 0){ - evalFactorList = evalFactorList.stream().map(t -> { - if(BidPrice.BID_PRICE_TOTAL_CODE.equals(t.getBidPriceCode())) { - t.setBidPriceCode(bidPriceList.get(0).getBidPriceCode()); - }else if(TAX.equals(t.getBidPriceCode()) || NO_TAX.equals(t.getBidPriceCode())){ - String tax; - if(TAX.equals(t.getBidPriceCode())) { - tax = "TAX_TOTAL_PRICE"; - }else { - tax = "NO_TAX_TOTAL_PRICE"; - } - BidPrice bidPriceResult = CollectionUtils.get(bidPriceList, s -> { - return tax.equals(s.getBidPriceCode()); - }); - if(bidPriceResult != null){ - t.setBidPriceCode(bidPriceResult.getBidPriceCode()); - } - } - return t; - }).collect(Collectors.toList()); - } // 批é‡ä¿å˜ if(evaluationFactorService.saveDownloadEvaluationFactor(tenderProjectEntity.getId(), evalFactorList) > 0){ callBackMsg(true, "[" + tenderProjectEntity.getTenderName() +"] " + evalFactorList.size() +"ä¸ªè¯„å®¡æŒ‡æ ‡ä¸‹è½½æˆåŠŸï¼"); diff --git a/OBE-MANAGEMENT/src/com/gx/obe/management/composite/PriceFactorsManagerComposite.java b/OBE-MANAGEMENT/src/com/gx/obe/management/composite/PriceFactorsManagerComposite.java index 7f8d5631a87de02170e75f5c069fa93e2aa2ee9e..a0b015bbd79f1b8fedf4c62b5cbe38b5f6b1c95e 100644 --- a/OBE-MANAGEMENT/src/com/gx/obe/management/composite/PriceFactorsManagerComposite.java +++ b/OBE-MANAGEMENT/src/com/gx/obe/management/composite/PriceFactorsManagerComposite.java @@ -41,6 +41,7 @@ import org.eclipse.swt.widgets.Text; import com.gx.obe.ColorConstants; import com.gx.obe.action.bean.Action; import com.gx.obe.business.entity.MenuFunction; +import com.gx.obe.common.file.utils.ParsingXmlUtils; import com.gx.obe.common.icons.IconsActivator; import com.gx.obe.common.widget.thread.SyncThread; import com.gx.obe.common.widget.utils.MenuFunctionUtils; @@ -58,6 +59,7 @@ import com.gx.obe.management.shell.BidPriceSelectShell; import com.gx.obe.management.shell.BidPriceSelectShell.BidPriceSelection; import com.gx.obe.message.Messages; import com.gx.obe.util.utils.BigDecimalUtils; +import com.gx.obe.util.utils.CollectionUtils; import com.gx.obe.util.utils.LogUtils; import com.gx.obe.util.utils.ObjectUtils; import com.gx.obe.util.utils.StringUtils; @@ -1057,7 +1059,7 @@ public class PriceFactorsManagerComposite extends Composite { } bidPriceResultService.updateBidPriceAndFinalPrice(supplierMap); } - //del_bid_price.setVisible(true); +// del_bid_price.setVisible(true); }else { curFactor.setBidPriceCode(null); if(null != curFactor.getId()){ @@ -1066,6 +1068,18 @@ public class PriceFactorsManagerComposite extends Composite { } } //éžç»“æž„åŒ–æŠ•æ ‡æŠ¥ä»·ä¿é™©å†™å…¥ + checkPriceName(); + showFormulaInfo(); + bid_price_text.getParent().layout(); + scroContentComposite.layout(); + scrolledComposite.setMinSize(scroContentComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + + /** + * @Description: åˆæ¬¡æ¸²æŸ“检查 + * @author lyb + */ + private void checkPriceName() { if(StringUtils.isEmpty(bid_price_text.getText())) { List<BidPrice> bidPriceList = bidPriceService.getBidPriceFactorList(tenderProject.getId()); if(bidPriceList != null && bidPriceList.size() == 1) { @@ -1073,11 +1087,41 @@ public class PriceFactorsManagerComposite extends Composite { curFactor.setBidPriceCode(bidPriceList.get(0).getBidPriceCode()); evaluationFactorService.updateAssignProperty(curFactor, new String[]{"id","bidPriceCode"}); } + if(bidPriceList != null && bidPriceList.size() == 2) { + String bidPriceCode = ParsingXmlUtils.parserStructBidProject(tenderProject); + if(StringUtils.isNotEmpty(bidPriceCode)) { + BidPrice bidPriceResult = null; + //æ ¹æ®æ‹›æ ‡æ–‡ä»¶é‡æ–°è§£æž + if(bidPriceCode.equals("bidPrice")) { + bidPriceCode = "TAX_TOTAL_PRICE"; + }else if(bidPriceCode.equals("noTaxBidPrice")){ + bidPriceCode = "NO_TAX_TOTAL_PRICE"; + } + for(BidPrice bidPrice :bidPriceList) { + if(bidPriceCode.equals(bidPrice.getBidPriceCode())) { + bidPriceResult = bidPrice; + break; + } + } + if(bidPriceResult != null){ + //æ ¹æ®æ–‡ä»¶è§£æžæ¸²æŸ“ + curFactor.setBidPriceCode(bidPriceResult.getBidPriceCode()); + bid_price_text.setText(bidPriceResult.getBidPriceName()); + evaluationFactorService.updateAssignProperty(curFactor, new String[]{"id","bidPriceCode"}); + }else { + //默认å«ç¨Ž + curFactor.setBidPriceCode(bidPriceList.get(0).getBidPriceCode()); + bid_price_text.setText(bidPriceList.get(0).getBidPriceName()); + evaluationFactorService.updateAssignProperty(curFactor, new String[]{"id","bidPriceCode"}); + } + }else { + //默认å«ç¨Ž + curFactor.setBidPriceCode(bidPriceList.get(0).getBidPriceCode()); + bid_price_text.setText(bidPriceList.get(0).getBidPriceName()); + evaluationFactorService.updateAssignProperty(curFactor, new String[]{"id","bidPriceCode"}); + } + } } - showFormulaInfo(); - bid_price_text.getParent().layout(); - scroContentComposite.layout(); - scrolledComposite.setMinSize(scroContentComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } /** diff --git a/com.gx.obe.common.file/src/com/gx/obe/common/file/utils/ParsingXmlUtils.java b/com.gx.obe.common.file/src/com/gx/obe/common/file/utils/ParsingXmlUtils.java index e2a2b2154f92256841257d9ee8eeea84e5075d7a..4be32644be18bc27ad4fb67ae40777b6c2acdd9d 100644 --- a/com.gx.obe.common.file/src/com/gx/obe/common/file/utils/ParsingXmlUtils.java +++ b/com.gx.obe.common.file/src/com/gx/obe/common/file/utils/ParsingXmlUtils.java @@ -3,7 +3,9 @@ package com.gx.obe.common.file.utils; import java.io.File; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -11,6 +13,7 @@ import java.util.stream.Stream; import org.dom4j.Document; import org.dom4j.Element; +import com.gx.obe.action.bean.Action; import com.gx.obe.business.entity.ScoreItem; import com.gx.obe.common.file.entity.BidFile; import com.gx.obe.common.file.enumeration.FileConstants; @@ -44,6 +47,7 @@ import com.gx.obe.util.utils.UuidUtils; import com.gx.obe.util.utils.XmlUtils; import com.gx.obe.web.entity.AttachmentFile; import com.gx.obe.web.entity.Struct; +import com.gx.obe.web.entity.Supplier; import com.gx.obe.web.entity.evaluation.EvaluationContent; import com.gx.obe.web.entity.evaluation.EvaluationFactor; import com.gx.obe.web.entity.evaluation.EvaluationStep; @@ -1212,4 +1216,50 @@ public class ParsingXmlUtils { } } + public static String parserStructBidProject(TenderProjectEntity tenderProjectEntity) { + // èŽ·å¾—æ‹›æ ‡æ–‡ä»¶çš„æŒ‡æ ‡Document + Document factorDoc = XmlUtils.getXmlDocument(FileConstants.getBiddingFilePath(tenderProjectEntity.getId()) + FileConstants.PSZB_XML); + return factorDoc == null ? "" : parsingDocStructBidXML(factorDoc, tenderProjectEntity); + } + + /** + * @Description: è§£æžæŠ•æ ‡æŠ¥ä»· + * @author lyb + * @param factorDoc + * @param tenderProjectEntity + * @return + */ + public static String parsingDocStructBidXML(Document factorDoc, TenderProjectEntity tenderProjectEntity) { + // èŽ·å–æ ¹å…ƒç´ + Element rootElement = factorDoc.getRootElement(); + Element packEvalFactorListElement = rootElement.element("packEvalFactorList"); + if (null != packEvalFactorListElement) { + //åˆ†åŒ…æ–‡ä»¶è§£æž + List<?> packEvalFactorsElements = packEvalFactorListElement.elements(); + if (null != packEvalFactorsElements && packEvalFactorsElements.size() > 0) { + for (Object object : packEvalFactorsElements) { + Element packsElement = (Element) object; + String packCode = packsElement.elementTextTrim("packCode"); + if (null == packCode || !packCode.equals(tenderProjectEntity.getTenderNo())) { + continue; + } + // 查找 priceFactors å…ƒç´ æœ‰ä¸”ä»…æœ‰ä¸€ä¸ªä»·æ ¼æŒ‡æ ‡ + Element priceFactorsElement = packsElement.element("priceFactors"); + if(priceFactorsElement != null) { + Element bidPriceCodeElement = priceFactorsElement.element("factor"); + try { + String bidPriceCode = bidPriceCodeElement.elementTextTrim("bidPriceCode"); + if (StringUtils.isNotEmpty(bidPriceCode)) { + return bidPriceCode; + } + }catch(Exception e) { + //nothing todo + return ""; + } + } + } + } + } + return ""; + } }