Commit 6e2b6f2c authored by liangyb's avatar liangyb

#328-6 适配复议后项目生成结构化

parent 7006b2b2
......@@ -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);
......
......@@ -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() +"个评审指标下载成功!");
......
......@@ -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));
}
/**
......
......@@ -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 "";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment