| 12345678910111213141516171819202122232425262728293031323334 | 
							- /**
 
-  * Created by zhang on 2017/11/22.
 
-  */
 
- let mongoose = require('mongoose');
 
- let projectsModel = mongoose.model('projects');
 
- let _ = require('lodash');
 
- module.exports ={
 
-     getProjectDecimal:getProjectDecimal,
 
-     getBillsQuantityDecimal:getBillsQuantityDecimal
 
- }
 
- async function getProjectDecimal(projectID,proj) {
 
-     let decimal = null;
 
-     let project = proj?proj:await projectsModel.findOne({ID:projectID});
 
-     if(project){
 
-         decimal = project.property.decimal
 
-     }
 
-     return decimal;
 
- }
 
- async function getBillsQuantityDecimal(projectID,unit,proj) {
 
-     let decimal = null;
 
-     let project =proj?proj:await projectsModel.findOne({ID:projectID});
 
-     if(project){
 
-         let billsQuantityDecimal = project.property.billsQuantityDecimal;
 
-         let el = _.find(billsQuantityDecimal,{'unit':unit});
 
-         if(!el){
 
-             el = billsQuantityDecimal[0];
 
-         }
 
-         decimal = el.decimal
 
-     }
 
-     return decimal;
 
- }
 
 
  |