|
@@ -0,0 +1,41 @@
|
|
|
+/**
|
|
|
+ * Created by zhang on 2018/1/22.
|
|
|
+ */
|
|
|
+let model = require("../../bills_lib/models/bills_lib_model");
|
|
|
+let Bills = model.billsMod;
|
|
|
+let _ = require("lodash");
|
|
|
+module.exports={
|
|
|
+ getSectionInfo : async function (data) {
|
|
|
+ console.log(data);
|
|
|
+ let conditions=[];
|
|
|
+ let fxList=[];
|
|
|
+ let billsLibId=0;
|
|
|
+ let sectionInfo ={};
|
|
|
+ for(let libID in data){
|
|
|
+ let codes=[];
|
|
|
+ let temp={};
|
|
|
+ let billsLibId = libID;
|
|
|
+ codes= _.keys(data[libID]);
|
|
|
+ temp['billsLibId']=libID;
|
|
|
+ temp['code'] = {"$in": codes};
|
|
|
+ conditions.push(temp);
|
|
|
+ }
|
|
|
+ if(conditions.length>0){
|
|
|
+ fxList = await Bills.find({"$or":conditions});
|
|
|
+ }
|
|
|
+ if(fxList.length>0){
|
|
|
+ let sectionIDs = {};
|
|
|
+ for(let f of fxList){
|
|
|
+ if(f._doc.sectionInfo){
|
|
|
+ f._doc.sectionInfo.first?sectionIDs[f._doc.sectionInfo.first]=true:"";
|
|
|
+ f._doc.sectionInfo.second?sectionIDs[f._doc.sectionInfo.second]=true:"";
|
|
|
+ f._doc.sectionInfo.third?sectionIDs[f._doc.sectionInfo.third]=true:"";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let IDList = _.keys(sectionIDs);
|
|
|
+ let sectionList = await Bills.find({"billsLibId":billsLibId,'ID':{'$in':IDList}});
|
|
|
+ console.log(sectionList);
|
|
|
+ console.log('getData');
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|