Commit ccf87f19 authored by liangyb's avatar liangyb

#328-4 下载项目入库指标逻辑调整

parent 63b6e6e3
......@@ -3,6 +3,7 @@ package com.gx.obe.thread;
import java.io.File;
import java.text.MessageFormat;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.log4j.Logger;
import org.dom4j.Document;
......@@ -20,6 +21,7 @@ import com.gx.obe.components.core.enumeration.CommonEnum;
import com.gx.obe.components.core.enumeration.TenderProjectEnum;
import com.gx.obe.components.core.util.MoneyUtils;
import com.gx.obe.message.Messages;
import com.gx.obe.util.utils.CollectionUtils;
import com.gx.obe.util.utils.DateUtils;
import com.gx.obe.util.utils.FileUtils;
import com.gx.obe.util.utils.ObjectUtils;
......@@ -28,9 +30,11 @@ import com.gx.obe.util.utils.UuidUtils;
import com.gx.obe.util.utils.XmlUtils;
import com.gx.obe.web.entity.BidOpeningRoom;
import com.gx.obe.web.entity.evaluation.EvaluationFactor;
import com.gx.obe.web.entity.price.BidPrice;
import com.gx.obe.web.entity.tender.TenderProjectEntity;
import com.gx.obe.web.entity.tender.TenderProjectRuleEntity;
import com.gx.obe.web.service.BidOpeningRoomService;
import com.gx.obe.web.service.BidPriceService;
import com.gx.obe.web.service.ProjectRuleService;
import com.gx.obe.web.service.TenderProjectService;
import com.gx.obe.web.service.evaluation.EvaluationFactorService;
......@@ -392,6 +396,7 @@ public class ImportTenderProjectThread implements Runnable {
try {
List<EvaluationFactor> evaluationFactorList = ParsingXmlUtils.analyELementXMl(element, childProject);
if (null != evaluationFactorList && evaluationFactorList.size() > 0) {
changeFactorList(evaluationFactorList, tenderProjectEntity);
if(evaluationFactorService.saveDownloadEvaluationFactor(tenderProjectEntity.getId(), evaluationFactorList) > 0){
callBackMsg(true, evaluationFactorList.size() +"个评审指标导入成功!");
} else {
......@@ -410,6 +415,7 @@ public class ImportTenderProjectThread implements Runnable {
try {
List<EvaluationFactor> evaluationFactorList = ParsingXmlUtils.analyELementXMl((Element)packEvalFactorList.get(0), tenderProjectEntity);
if (null != evaluationFactorList && evaluationFactorList.size() > 0) {
changeFactorList(evaluationFactorList, tenderProjectEntity);
if(evaluationFactorService.saveDownloadEvaluationFactor(tenderProjectEntity.getId(), evaluationFactorList) > 0){
callBackMsg(true, evaluationFactorList.size() +"个评审指标导入成功!");
} else {
......@@ -424,7 +430,30 @@ 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());
return evalFactorList = evalFactorList.stream().map(t -> {
if(BidPrice.BID_PRICE_TOTAL_CODE.equals(t.getBidPriceCode()) && bidPriceList.size() == 1) {
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());
});
t.setBidPriceCode(bidPriceResult.getBidPriceCode());
}
return t;
}).collect(Collectors.toList());
}
private void callBackMsg(String msg){
if(null != callBack){
callBack.callBackString(" "+ msg);
......
......@@ -2,6 +2,7 @@ package com.gx.obe.thread;
import java.io.File;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.log4j.Logger;
import org.dom4j.Document;
......@@ -19,10 +20,13 @@ import com.gx.obe.common.file.utils.ParsingXmlUtils;
import com.gx.obe.common.widget.listener.ProgressMessageListener;
import com.gx.obe.common.widget.thread.MyThread;
import com.gx.obe.config.utils.PropertiesUtils;
import com.gx.obe.util.utils.CollectionUtils;
import com.gx.obe.util.utils.StringUtils;
import com.gx.obe.web.entity.TransactionServer;
import com.gx.obe.web.entity.evaluation.EvaluationFactor;
import com.gx.obe.web.entity.price.BidPrice;
import com.gx.obe.web.entity.tender.TenderProjectEntity;
import com.gx.obe.web.service.BidPriceService;
import com.gx.obe.web.service.evaluation.EvaluationFactorService;
/**
......@@ -125,6 +129,27 @@ 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());
evalFactorList = evalFactorList.stream().map(t -> {
if(BidPrice.BID_PRICE_TOTAL_CODE.equals(t.getBidPriceCode()) && bidPriceList.size() == 1) {
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());
});
t.setBidPriceCode(bidPriceResult.getBidPriceCode());
}
return t;
}).collect(Collectors.toList());
// 批量保存
if(evaluationFactorService.saveDownloadEvaluationFactor(tenderProjectEntity.getId(), evalFactorList) > 0){
callBackMsg(true, "[" + tenderProjectEntity.getTenderName() +"] " + evalFactorList.size() +"个评审指标下载成功!");
......
......@@ -116,7 +116,6 @@ public class EvaluationFactorXmlResolverThread implements Runnable {
}
if (null != factorList) {
if(factorList.size() > 0){
//.equals(BidPrice.BID_PRICE_TOTAL_CODE)
BidPriceService bidPriceService = new BidPriceService();
List<BidPrice> bidPriceList = bidPriceService.getBidPriceFactorList(tenderProjectEntity.getId());
factorList = factorList.stream().map(t -> {
......
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