project_model.js 24 KB

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