project_model.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. /**
  2. * Created by Mai on 2017/1/18.
  3. */
  4. import mongoose from 'mongoose';
  5. import async_c from 'async';
  6. import UnitPriceFileModel from "../../glj/models/unit_price_file_model";
  7. import UnitPriceFiles from '../../glj/models/schemas/unit_price_file';
  8. import {defaultDecimal, billsQuantityDecimal, basicInformation, projectFeature,displaySetting} from './project_property_template';
  9. let FeeRateFiles = mongoose.model('fee_rate_file');
  10. let counter = require("../../../public/counter/counter.js");
  11. let newProjController = require('../controllers/new_proj_controller');
  12. let copyProjController = require('../controllers/copy_proj_controller');
  13. let feeRateFacade = require('../../fee_rates/facade/fee_rates_facade');
  14. let labourCoeFacade = require('../../main/facade/labour_coe_facade');
  15. let calcProgramFacade = require('../../main/facade/calc_program_facade');
  16. let logger = require("../../../logs/log_helper").logger;
  17. let Projects = require("./project_schema");
  18. let projectType = {
  19. folder: 'Folder',
  20. tender: 'Tender',
  21. project: 'Project',
  22. engineering: 'Engineering',
  23. };
  24. let fileType = {
  25. unitPriceFile: 'UnitPriceFile',
  26. feeRateFile: 'FeeRateFile'
  27. };
  28. let ProjectsDAO = function(){};
  29. ProjectsDAO.prototype.getUserProjects = function(userId, compilation, callback){
  30. Projects.find({'$or': [{'userID': userId, 'compilation': compilation, 'deleteInfo': null}, {'userID': userId, 'compilation': compilation, 'deleteInfo.deleted': {'$in': [null, false]}}]}, '-_id', function(err, templates){
  31. if (err) {
  32. callback(1, 'Error', null);
  33. } else {
  34. callback(0, '', templates);
  35. }
  36. });
  37. };
  38. ProjectsDAO.prototype.getUserProject = function (userId, ProjId, callback) {
  39. Projects.findOne({userID: userId, ID: ProjId}, '-_id', function(err, template){
  40. if (err) {
  41. callback(1, '找不到标段数据', null);
  42. } else {
  43. callback(0, '', template);
  44. }
  45. });
  46. }
  47. ProjectsDAO.prototype.updateUserProjects = async function(userId, compilationId, datas, callback){
  48. let data, project, updateLength = 0, hasError = false, deleteInfo = null, i, newProject;
  49. let updateAll = function (err) {
  50. if (!err){
  51. updateLength += 1;
  52. if (updateLength === datas.length) {
  53. callback(0, '', datas);
  54. }
  55. } else {
  56. hasError = true;
  57. console.log(err);
  58. callback(1, '提交数据出错.', null);
  59. }
  60. };
  61. if (datas){
  62. for (i = 0; i < datas.length && !hasError; i++){
  63. data = datas[i];
  64. if (data.updateData.name !== undefined) {
  65. data.updateData.name = data.updateData.name.trim();
  66. }
  67. if (data.updateType === 'update') {
  68. Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll);
  69. } else if (data.updateType === 'new') {
  70. data.updateData['userID'] = userId;
  71. data.updateData['compilation'] = compilationId;
  72. data.updateData['createDateTime'] = new Date();
  73. // 如果没有选中单价文件则新增单价文件
  74. if (data.updateData.projType === projectType.tender && data.updateData.property !== null &&
  75. Object.keys(data.updateData.property.unitPriceFile).length > 0 &&
  76. data.updateData.property.unitPriceFile.id === '') {
  77. let unitPriceFileModel = new UnitPriceFileModel();
  78. let insertData = {
  79. name: data.updateData.name,
  80. project_id: data.updateData.ID,
  81. user_id: userId,
  82. root_project_id: data.updateData.property.rootProjectID
  83. };
  84. let addResult = await unitPriceFileModel.add(insertData);
  85. if (!addResult) {
  86. callback(1, '新增单价文件失败.', null);
  87. return;
  88. }
  89. data.updateData.property.unitPriceFile.id = addResult.id;
  90. }
  91. if(data.updateData.projType === projectType.tender){
  92. //小数位数
  93. data.updateData.property.decimal = defaultDecimal;
  94. //清单工程量精度
  95. data.updateData.property.billsQuantityDecimal = billsQuantityDecimal;
  96. //基本信息
  97. basicInformation[0]['items'][1]['value'] = data.updateData.property.engineeringName || '';
  98. data.updateData.property.basicInformation = basicInformation;
  99. //工程特征
  100. data.updateData.property.projectFeature = projectFeature;
  101. //呈现选项
  102. data.updateData.property.displaySetting = displaySetting;
  103. data.updateData.property.billsCalcMode = 0;
  104. data.updateData.property.zanguCalcMode = 0;
  105. }
  106. newProject = new Projects(data.updateData);
  107. // 查找同级是否存在同名数据
  108. let exist = await this.isExist(userId, compilationId, data.updateData.name, data.updateData.ParentID);
  109. if (exist) {
  110. callback(1, '同级目录已存在相同名称数据.', null);
  111. return;
  112. }
  113. if(data.updateData.projType==='Tender'){
  114. let feeRateFileID = await feeRateFacade.newFeeRateFile(userId, data.updateData);
  115. newProject.property.feeFile = feeRateFileID?feeRateFileID:-1;
  116. // 新建人工系数文件 CSL, 2017.10.13
  117. let lcFile = await labourCoeFacade.newProjectLabourCoe(data.updateData);
  118. newProject.property.labourCoeFile = lcFile ? lcFile : null;
  119. // 新建计算程序文件 CSL, 2017.10.23
  120. let cpFile = await calcProgramFacade.newProjectCalcProgramFile(data.updateData);
  121. newProject.property.calcProgramFile = cpFile ? cpFile : null;
  122. }
  123. newProject.save(async function (err, result) {
  124. if (!err && result._doc.projType === projectType.tender) {
  125. newProjController.copyTemplateData(result._doc.property, newProject.ID, updateAll);
  126. } else {
  127. updateAll(err);
  128. }
  129. });
  130. } else if (data.updateType === 'delete') {
  131. deleteInfo = {};
  132. deleteInfo['deleted'] = true;
  133. deleteInfo['deleteDateTime'] = new Date();
  134. deleteInfo['deleteBy'] = userId;
  135. data.updateData['deleteInfo'] = deleteInfo;
  136. //Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll);
  137. //update
  138. try{
  139. if(data.updateData.projType === projectType.project){
  140. let engineerings = await Projects.find({userID: userId, ParentID: data.updateData.ID});
  141. let isExist = false;
  142. if(engineerings.length > 0){
  143. for(let j = 0, jLen = engineerings.length; j < jLen; j++){
  144. let e_tenders = await Projects.find({userID: userId, ParentID: engineerings[j].ID});
  145. if(e_tenders.length > 0){
  146. isExist = true;
  147. break;
  148. }
  149. }
  150. }
  151. if(isExist){//fake
  152. await UnitPriceFiles.update({user_id: userId, root_project_id: data.updateData.ID}, {$set: {deleteInfo: deleteInfo}}, {multi: true});
  153. await FeeRateFiles.update({userID: userId, rootProjectID: data.updateData.ID}, {$set: {deleteInfo: deleteInfo}}, {multi: true});
  154. await Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll);
  155. }
  156. else {//true
  157. await UnitPriceFiles.remove({user_id: userId, root_project_id: data.updateData.ID});
  158. await FeeRateFiles.remove({userID: userId, rootProjectID: data.updateData.ID});
  159. //await Projects.update({userID: userId, NextSiblingID: data.updateData.ID, deleteInfo: null}, {$set: {NextSiblingID: data.NextSiblingID}});
  160. await Projects.remove({userID: userId, ID: data.updateData.ID}, updateAll);
  161. }
  162. }
  163. else if(data.updateData.projType === projectType.engineering){
  164. let tenders = await Projects.find({userID: userId, ParentID: data.updateData.ID});
  165. if(tenders.length > 0){//fake
  166. await Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll);
  167. }
  168. else {//true
  169. //await Projects.update({userID: userId, NextSiblingID: data.updateData.ID, deleteInfo: null}, {$set: {NextSiblingID: data.NextSiblingID}});
  170. await Projects.remove({userID: userId, ID: data.updateData.ID}, updateAll);
  171. }
  172. }
  173. else if(data.updateData.projType === projectType.tender){//fake
  174. await Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll);
  175. }
  176. else if(data.updateData.projType === projectType.folder){//true
  177. await Projects.remove({userID: userId, ID: data.updateData.ID}, updateAll);
  178. }
  179. else throw '未知文件类型,删除失败!';
  180. }
  181. catch (error){
  182. callback(1, error, null);
  183. }
  184. } else {
  185. hasError = true;
  186. callback(1, '提交数据错误.', null);
  187. }
  188. }
  189. }
  190. };
  191. ProjectsDAO.prototype.udpateUserFiles = async function (userId, datas, callback){
  192. let updateType = {update: 'update', delete: 'delete'};
  193. let deleteInfo = Object.create(null);
  194. deleteInfo.deleted = true;
  195. deleteInfo.deleteBy = userId;
  196. deleteInfo.deleteDateTime = new Date();
  197. try{
  198. for(let i = 0, len = datas.length; i < len; i++){
  199. let data = datas[i];
  200. if(data.updateType === updateType.update && data.fileType === fileType.unitPriceFile){
  201. await UnitPriceFiles.update({user_id: userId, id: parseInt(data.updateData.id)}, data.updateData);
  202. await Projects.update({userID: userId, 'property.unitPriceFile.id': data.updateData.id}, {$set: {'property.unitPriceFile.name': data.updateData.name}});
  203. }
  204. else if(data.updateType === updateType.update && data.fileType === fileType.feeRateFile){
  205. await FeeRateFiles.update({userID: userId, ID: data.updateData.ID}, data.updateData);
  206. await Projects.update({userID: userId, 'property.feeFile.id': data.updateData.ID}, {$set: {'property.feeFile.name': data.updateData.name}});
  207. }
  208. else if(data.updateType === updateType.delete && data.fileType === fileType.unitPriceFile){
  209. data.updateData.deleteInfo = deleteInfo;
  210. await UnitPriceFiles.update({user_id: userId, id: parseInt(data.updateData.id)}, data.updateData);
  211. await Projects.update({userID: userId, 'property.feeFile.id': data.updateData.id}, {$set: {'property.feeFile.name': data.updateData.name}});
  212. }
  213. else if(data.updateType === updateType.delete && data.fileType === fileType.feeRateFile){
  214. data.updateData.deleteInfo = deleteInfo;
  215. await FeeRateFiles.update({userID: userId, ID: data.updateData.ID}, data.updateData);
  216. }
  217. else throw '未知文件类型,删除失败'
  218. }
  219. callback(false, '删除成功', null);
  220. }
  221. catch(error){
  222. callback(true, '删除失败', null);
  223. }
  224. };
  225. ProjectsDAO.prototype.copyUserProjects = function (userId, datas, callback) {
  226. let data, project, updateLength = 0, hasError = false, deleteInfo = null, tempType = 1, i;
  227. let updateAll = function (err) {
  228. if (!err){
  229. updateLength += 1;
  230. if (updateLength === datas.length) {
  231. callback(0, '', datas);
  232. }
  233. } else {
  234. hasError = true;
  235. callback(1, '提交数据出错.', null);
  236. }
  237. };
  238. if (datas) {
  239. for (i = 0; i < datas.length && !hasError; i++) {
  240. data = datas[i];
  241. if (data.updateType === 'update') {
  242. Projects.update({userID: userId, ID: data.updateData.ID}, data.updateData, updateAll)
  243. } else if (data.updateType === 'copy') {
  244. data.updateData['userID'] = userId;
  245. data.updateData['createDateTime'] = new Date();
  246. let newProject = new Projects(data.updateData);
  247. newProject['srcProjectId'] = data.srcProjectId;
  248. newProject.save(function (err, result) {
  249. if (!err && result._doc.projType === 'Tender') {
  250. copyProjController.copyProjectData(newProject.srcProjectId, result._doc.ID, updateAll);
  251. } else {
  252. updateAll(err);
  253. }
  254. });
  255. } else {
  256. hasError = true;
  257. callback(1, '提交数据错误', null);
  258. }
  259. }
  260. }
  261. };
  262. ProjectsDAO.prototype.rename = async function (userId, compilationId, data, callback){
  263. try {
  264. if (data.id === undefined || data.id === '') {
  265. throw '数据错误!';
  266. }
  267. if (data.newName === undefined || data.newName === '') {
  268. throw '请填写名称!';
  269. }
  270. data.newName = data.newName.trim();
  271. // 查找同级是否存在同名数据
  272. let exist = await this.isExist(userId, compilationId, data.newName, data.parentID);
  273. if (exist) {
  274. throw '同级目录已存在相同名称数据';
  275. }
  276. Projects.update({userID: userId, ID: data.id}, {name: data.newName}, function(err){
  277. if (err){
  278. throw '项目不存在';
  279. }
  280. });
  281. } catch (error) {
  282. callback(1, error, null);
  283. return;
  284. }
  285. callback(0, '');
  286. };
  287. ProjectsDAO.prototype.beforeOpenProject = function (userId, projectId, updateData, callback){
  288. updateData['recentDateTime'] = new Date();
  289. Projects.update({userID: userId, ID: projectId}, updateData, function(err){
  290. if (err){
  291. callback(1, '项目不存在.');
  292. } else {
  293. callback(0, '');
  294. }
  295. });
  296. };
  297. ProjectsDAO.prototype.getNewProjectID = function (count, callback) {
  298. counter.counterDAO.getIDAfterCount(counter.moduleName.project, count, function (err, result) {
  299. let highID = result.value.sequence_value;
  300. if (!err) {
  301. callback(0, '', {lowID: highID - count + 1, highID: highID});
  302. } else {
  303. callback(1, '获取主键失败', null);
  304. }
  305. });
  306. };
  307. ProjectsDAO.prototype.getProject = function (key, callback) {
  308. if (callback) {
  309. Projects.findOne({'_id': key}, function (err, result) {
  310. if (err) {
  311. callback(1, '查找标段失败');
  312. } else {
  313. callback(0, result);
  314. }
  315. });
  316. } else {
  317. return Projects.findOne({'ID': key}).exec();
  318. }
  319. };
  320. ProjectsDAO.prototype.getProjectsByIds = async function (userId, compilationId, ids){
  321. return await Projects.find({userID: userId, compilation: compilationId, ID: {$in: ids}});
  322. };
  323. ProjectsDAO.prototype.getGCFiles = async function (fileType, userID){
  324. let rst;
  325. if(fileType === 'UnitPriceFile'){
  326. let unitPriceFileModel = new UnitPriceFileModel();
  327. rst = await unitPriceFileModel.getGCUnitPriceFiles(userID);
  328. }
  329. else if(fileType === 'FeeRateFile'){
  330. rst = await feeRateFacade.getGCFeeRateFiles(userID);
  331. }
  332. else {
  333. let isExist = false;
  334. for(let type in projectType){
  335. if(projectType[type] === fileType) {
  336. isExist = true;
  337. break;
  338. }
  339. }
  340. if(!isExist) throw '不存在此项目类型!';
  341. rst = await Projects.find({userID: userID, projType: fileType, 'deleteInfo.deleted': true});
  342. }
  343. return rst;
  344. };
  345. ProjectsDAO.prototype.getFirstNodeID = async function (userID, pid) {
  346. let nodes = await Projects.find({userID: userID, ParentID: pid, deleteInfo: null});
  347. if(nodes.length === 0){
  348. return -1;
  349. }
  350. else {
  351. let prefix = 'ID_';
  352. let chain = Object.create(null);
  353. for(let i = 0, len = nodes.length; i < len; i++){
  354. let nodeDoc = nodes[i]._doc;
  355. let node = Object.create(null);
  356. node.ID = nodeDoc.ID;
  357. node.NextSiblingID = nodeDoc.NextSiblingID;
  358. chain[prefix + node.ID] = node;
  359. }
  360. for(let i =0, len = nodes.length; i < len; i++){
  361. let nodeDoc = nodes[i]._doc;
  362. let next = nodeDoc.NextSiblingID > 0 ? chain[prefix + nodeDoc.NextSiblingID] : null;
  363. chain[prefix + nodeDoc.ID].next = next;
  364. if(next){
  365. next.pre = chain[prefix + nodeDoc.ID]
  366. }
  367. }
  368. for(let node in chain){
  369. let pre = chain[node].pre || null;
  370. if(!pre){
  371. return chain[node].ID;
  372. }
  373. }
  374. }
  375. };
  376. ProjectsDAO.prototype.recGC = async function(userID, datas, callback){
  377. let functions = [];
  378. let updateDatas = [];
  379. for(let i = 0, len = datas.length; i < len; i++){
  380. if(datas[i].findData.ParentID !== undefined && datas[i].findData.NextSiblingID === -1 && !datas[i].findData.deleteInfo){//维护项目管理树
  381. let findNode = await Projects.find(datas[i].findData);
  382. if(findNode.length > 0){
  383. datas[i].findData = Object.create(null);
  384. datas[i].findData.ID = findNode[0].ID;
  385. updateDatas.push(datas[i]);
  386. }
  387. }
  388. else {
  389. if(datas[i].updateType === projectType.project && datas[i].updateData.NextSiblingID === undefined){//则为待查询NextSiblingID,前端无法查询
  390. let projData = await Projects.find({userID: userID, ID: datas[i].findData.ID});//建设项目原本可能属于某文件夹、文件夹的存在需要判断
  391. let projPid = projData[0].ParentID;
  392. if(projPid !== -1){
  393. let projFolder = await Projects.find({userID: userID, ID: projPid});
  394. if(projFolder.length === 0){//文件夹已不存在
  395. projPid = -1;
  396. datas[i].updateData.ParentID = -1;
  397. }
  398. }
  399. let firstNodeID = await this.getFirstNodeID(userID, projPid);
  400. datas[i].updateData.NextSiblingID = firstNodeID;
  401. }
  402. updateDatas.push(datas[i])
  403. }
  404. }
  405. for(let i = 0, len = updateDatas.length; i < len; i ++){
  406. functions.push((function(data){
  407. return function (cb) {
  408. if(data.updateType === fileType.unitPriceFile){
  409. UnitPriceFiles.update({id: parseInt(data.findData.id)}, data.updateData, function (err) {
  410. if(err) cb(err);
  411. else {
  412. Projects.update({userID: userID, 'property.unitPriceFile.id': data.findData.id}, {$set: {'property.unitPriceFile.name': data.updateData.name}}, function (err) {
  413. if(err) cb(err);
  414. else cb(false);
  415. });
  416. }
  417. })
  418. }
  419. else if(data.updateType === fileType.feeRateFile){
  420. FeeRateFiles.update(data.findData, data.updateData, function (err) {
  421. if(err) cb(err);
  422. else {
  423. Projects.update({userID: userID, 'property.feeFile.id': data.findData.ID}, {$set: {'property.feeFile.name': data.updateData.name}}, function (err) {
  424. if(err) cb(err);
  425. else cb(false);
  426. });
  427. }
  428. });
  429. }
  430. else{
  431. if(data){
  432. Projects.update(data.findData, data.updateData, function (err) {
  433. if(err)cb(err);
  434. else cb(false);
  435. });
  436. }
  437. }
  438. }
  439. }
  440. )(updateDatas[i]));
  441. }
  442. async_c.parallel(functions, function (err, results) {
  443. if(err) callback(err, 'fail', null);
  444. else callback(0, 'success', null);
  445. });
  446. };
  447. /**
  448. * 整理工程专业对应标准库数据
  449. *
  450. * @param {Object} data
  451. * @return {Boolean}
  452. */
  453. ProjectsDAO.prototype.isExist = async function(userId, compilationId, name, parentID) {
  454. parentID = parseInt(parentID);
  455. if (name === '' || isNaN(parentID)) {
  456. return true;
  457. }
  458. let condition = {userID: userId, compilation: compilationId, ParentID: parentID, name: name, "$or":[{deleteInfo: null}, {"deleteInfo.deleted": false}]};
  459. let count = await Projects.count(condition);
  460. return count > 0;
  461. };
  462. /**
  463. * 获取对应建设项目下所有的单位工程id
  464. *
  465. * @param {Number} projectId
  466. * @return {Promise}
  467. */
  468. ProjectsDAO.prototype.getTenderByProjectId = async function(projectId) {
  469. let result = [];
  470. // 首先获取对应的单位工程id
  471. let engineeringData = await Projects.find({ParentID: projectId});
  472. if (engineeringData.length <= 0) {
  473. return result;
  474. }
  475. let engineeringIdList = [];
  476. for(let tmp of engineeringData) {
  477. engineeringIdList.push(tmp.ID);
  478. }
  479. // 查找对应的单位工程id
  480. let tenderData = await Projects.find({ParentID: {$in: engineeringIdList}});
  481. if (tenderData.length <= 0) {
  482. return result;
  483. }
  484. for(let tmp of tenderData) {
  485. result.push(tmp.ID);
  486. }
  487. return result;
  488. };
  489. /**
  490. * 根据单价文件id获取对应的标段数据
  491. *
  492. * @param {Number} unitPriceFileId
  493. * @return {Promise}
  494. */
  495. ProjectsDAO.prototype.getTenderByUnitPriceFileId = async function(unitPriceFileId) {
  496. let result = [];
  497. unitPriceFileId = parseInt(unitPriceFileId);
  498. if (isNaN(unitPriceFileId) && unitPriceFileId <= 0) {
  499. return result;
  500. }
  501. let condition = {projType: 'Tender', "property.unitPriceFile.id": unitPriceFileId};
  502. result = await Projects.find(condition);
  503. return result;
  504. };
  505. /**
  506. * 根据项目id获取单价文件列表id
  507. *
  508. * @param {Number} projectId
  509. * @return {Promise}
  510. */
  511. ProjectsDAO.prototype.getUnitPriceFileId = async function(projectId) {
  512. let result = 0;
  513. let projectData = await Projects.findOne({ID: projectId});
  514. if (projectData === null) {
  515. return result;
  516. }
  517. result = projectData.property.unitPriceFile !== undefined ? projectData.property.unitPriceFile.id : 0;
  518. return result;
  519. };
  520. /**
  521. * 获取当前用户的建设项目数据
  522. *
  523. * @param {Number} userId
  524. * @return {Promise}
  525. */
  526. ProjectsDAO.prototype.getUserProjectData = async function(userId) {
  527. let projectList = await Projects.find({
  528. '$or': [
  529. {'userID': userId, 'deleteInfo': null, projType: 'Project'},
  530. {'userID': userId, 'deleteInfo.deleted': {'$in': [null, false]}, projType: 'Project'}
  531. ]
  532. }, {_id: 0, name: 1, ID: 1});
  533. return projectList;
  534. };
  535. /**
  536. * 更改项目属性中的单价文件
  537. *
  538. * @param {Number} projectId
  539. * @param {Object} changeInfo
  540. * @return {Promise}
  541. */
  542. ProjectsDAO.prototype.changeUnitPriceFileInfo = async function(projectId, changeInfo) {
  543. projectId = parseInt(projectId);
  544. if (isNaN(projectId) || projectId <= 0) {
  545. return false;
  546. }
  547. let result = await Projects.update({ID: projectId}, {"property.unitPriceFile": changeInfo});
  548. return result.ok === 1;
  549. };
  550. module.exports ={
  551. project: new ProjectsDAO(),
  552. projType: projectType,
  553. fileType: fileType
  554. };