123456789101112131415161718192021222324252627282930313233 |
- /**
- * Created by zhang on 2017/11/22.
- */
- let projectsModel = require("../../pm/models/project_schema");
- let _ = require('lodash');
- module.exports ={
- getProjectDecimal:getProjectDecimal,
- getBillsQuantityDecimal:getBillsQuantityDecimal
- }
- async function getProjectDecimal(projectID) {
- let decimal = null;
- let project =await projectsModel.findOne({ID:projectID});
- if(project){
- decimal = project.property.decimal
- }
- return decimal;
- }
- async function getBillsQuantityDecimal(projectID,unit) {
- let decimal = null;
- let project =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;
- }
|