|
@@ -9,6 +9,7 @@
|
|
|
};
|
|
};
|
|
|
//先导出后require可以解决循环引用问题
|
|
//先导出后require可以解决循环引用问题
|
|
|
module.exports={
|
|
module.exports={
|
|
|
|
|
+ getBasicInfo,
|
|
|
getProjectByGranularity,
|
|
getProjectByGranularity,
|
|
|
prepareShareList,
|
|
prepareShareList,
|
|
|
getShareList,
|
|
getShareList,
|
|
@@ -106,11 +107,14 @@ const {
|
|
|
fixedFlag,
|
|
fixedFlag,
|
|
|
SharePermissionChangeType,
|
|
SharePermissionChangeType,
|
|
|
GRANULARITY,
|
|
GRANULARITY,
|
|
|
|
|
+ BOQType
|
|
|
} = require('../../../public/common_constants');
|
|
} = require('../../../public/common_constants');
|
|
|
const notDeleted = [{deleteInfo: null}, {'deleteInfo.deleted': false}];
|
|
const notDeleted = [{deleteInfo: null}, {'deleteInfo.deleted': false}];
|
|
|
let cipher = require('../../../public/cipher');
|
|
let cipher = require('../../../public/cipher');
|
|
|
let index = require("../../system_setting/model/index");
|
|
let index = require("../../system_setting/model/index");
|
|
|
const compilationModel = mongoose.model('compilation');
|
|
const compilationModel = mongoose.model('compilation');
|
|
|
|
|
+const engineeringModel = mongoose.model('engineering_lib');
|
|
|
|
|
+const basicInfoModel = mongoose.model('std_basic_info_lib');
|
|
|
let qiniu = require("qiniu");
|
|
let qiniu = require("qiniu");
|
|
|
let fs = require("fs");
|
|
let fs = require("fs");
|
|
|
let path = require("path");
|
|
let path = require("path");
|
|
@@ -1099,15 +1103,19 @@ function isDef(v){
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function getTotalFee(bills, feeName) {
|
|
function getTotalFee(bills, feeName) {
|
|
|
- if(!isDef(bills)){
|
|
|
|
|
|
|
+ if (!isDef(bills)) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- if(!isDef(bills.fees) || bills.fees.length <= 0){
|
|
|
|
|
|
|
+ if (!isDef(bills.fees) || bills.fees.length <= 0) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- for(let fee of bills.fees){
|
|
|
|
|
- if(isDef(fee.fieldName) && fee.fieldName === feeName){
|
|
|
|
|
- return isDef(fee.totalFee) ? fee.totalFee : 0;
|
|
|
|
|
|
|
+ for (let fee of bills.fees) {
|
|
|
|
|
+ if (isDef(fee.fieldName) && fee.fieldName === feeName) {
|
|
|
|
|
+ return isDef(fee.tenderTotalFee)
|
|
|
|
|
+ ? fee.tenderTotalFee
|
|
|
|
|
+ : isDef(fee.totalFee)
|
|
|
|
|
+ ? fee.totalFee
|
|
|
|
|
+ : 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
return 0;
|
|
return 0;
|
|
@@ -2256,3 +2264,39 @@ async function getProjectByGranularity(tenderID, granularity, requestForSummaryI
|
|
|
constructionProject.softInfo = `${company};${versionName};${version};${userID}`;
|
|
constructionProject.softInfo = `${company};${versionName};${version};${userID}`;
|
|
|
return constructionProject;
|
|
return constructionProject;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+//获取费用定额绑定的基本信息库数据
|
|
|
|
|
+async function getBasicInfo(compilationID, fileKind = null) {
|
|
|
|
|
+ const compilation = await compilationModel.findOne({_id: mongoose.Types.ObjectId(compilationID)});
|
|
|
|
|
+ if (!compilation) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ const billValuation = compilation.bill_valuation.find(function (data) {
|
|
|
|
|
+ return data.enable;
|
|
|
|
|
+ });
|
|
|
|
|
+ if (!billValuation) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ const engineerings = await engineeringModel.find({valuationID: billValuation.id}).lean();
|
|
|
|
|
+ const engineering = engineerings.find(function (data) {
|
|
|
|
|
+ return data.info_lib && data.info_lib.length > 0;
|
|
|
|
|
+ });
|
|
|
|
|
+ if (!engineering || !engineering.info_lib || !engineering.info_lib[0]) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ const infoLib = await basicInfoModel.findOne({ID: engineering.info_lib[0].id});
|
|
|
|
|
+ //提取文件类型中需要的数据 (投标项目可能不需要招标的一些信息)
|
|
|
|
|
+ if (fileKind && infoLib && infoLib.info && infoLib.info.length) {
|
|
|
|
|
+ const strMap = {
|
|
|
|
|
+ [BOQType.BID_SUBMISSION]: '投标',
|
|
|
|
|
+ [BOQType.BID_INVITATION]: '招标',
|
|
|
|
|
+ };
|
|
|
|
|
+ const needfulData = infoLib.info.filter(data => !data.fileKind || data.fileKind === strMap[fileKind]);
|
|
|
|
|
+ needfulData.forEach(nData => {
|
|
|
|
|
+ let needfulSub = nData.items.filter(sData => !sData.fileKind || sData.fileKind === strMap[fileKind]);
|
|
|
|
|
+ nData.items = needfulSub;
|
|
|
|
|
+ });
|
|
|
|
|
+ infoLib.info = needfulData;
|
|
|
|
|
+ }
|
|
|
|
|
+ return infoLib;
|
|
|
|
|
+}
|