Ejemplo n.º 1
0
 def getRelEnts(self, lcid):
     # 获得企业的详细信息
     # ent = Enterprise.objects(lcid=lcid).only("lcid").first()
     relEnts = Entsrelation.objects(entsource=lcid)
     if len(relEnts) > 0:
         yield relEnts
         for relent in relEnts:
             for ent in self.getRelEnts(relent["enttarget"]):
                 yield ent
Ejemplo n.º 2
0
 def getRelEnts(self, lcid):
     # 获得企业的详细信息
     # ent = Enterprise.objects(lcid=lcid).only("lcid").first()
     relEnts = Entsrelation.objects(entsource=lcid)
     if len(relEnts)>0:
         yield relEnts
         for relent in relEnts:
             for ent in self.getRelEnts(relent["enttarget"]):
                 yield ent
Ejemplo n.º 3
0
 def get(self, lcid):
     enterprise = Enterprise.objects(lcid=lcid).first()
     entprerelations = Entprerelation.objects(enttarget=lcid)
     entsrelations = Entsrelation.objects(entsource=lcid)
     entpatents = Entpatent.objects(lcid=lcid)
     obj = {}
     obj["enterprise"] = self.load_json(enterprise)
     obj["entprerelations"] = self.load_json(entprerelations)
     obj["entsrelations"] = self.load_json(entsrelations)
     obj["entpatents"] = self.load_json(entpatents)
     # relEnts = Entsrelation.objects(entsource=lcid).to_json()
     # print len(relEnts)
     if enterprise:
         return Status(200, 'success', obj).result
     else:
         return Status(404, 'fail', {'title': 'Not Found'}).result
Ejemplo n.º 4
0
    def getRelEnts(self, lcid):
        # 获得企业的相关企业信息
        obj = {}
        obj["children"] = []
        obj["parent"] = json.loads(Enterprise.objects(lcid=lcid).only("lcid", "entname", "regcap", "entindustry").first().to_json())
        childrens = json.loads(Entsrelation.objects(entsource=lcid).only("enttarget", "entname", "entsource").to_json())
        obj["investment"] = json.loads(Entprerelation.objects(enttarget=lcid).only("entpre", "conprop").to_json())

        for relent in childrens:
            if Enterprise.objects(lcid=relent["enttarget"]).first() is not None:
                obj["children"].append(relent)
        self.rawdata.append(obj)
        # 自动递归
        if len(obj["children"]):
            for relent in obj["children"]:
                    self.getRelEnts(relent["enttarget"])
Ejemplo n.º 5
0
 def get(self, lcid):
     enterprise = Enterprise.objects(lcid=lcid).first()
     entprerelations = Entprerelation.objects(enttarget=lcid)
     entsrelations = Entsrelation.objects(entsource=lcid)
     entpatents = Entpatent.objects(lcid=lcid)
     obj = {}
     obj["enterprise"] = self.load_json(enterprise)
     obj["entprerelations"] = self.load_json(entprerelations)
     obj["entsrelations"] = self.load_json(entsrelations)
     obj["entpatents"] = self.load_json(entpatents)
     # relEnts = Entsrelation.objects(entsource=lcid).to_json()
     # print len(relEnts)
     if enterprise:
         return Status(200, 'success', obj).result
     else:
         return Status(404, 'fail', {'title':'Not Found'}).result
Ejemplo n.º 6
0
    def getRelEnts(self, lcid):
        # 获得企业的相关企业信息
        obj = {}
        obj["children"] = []
        obj["parent"] = json.loads(Enterprise.objects(lcid=lcid).only("lcid", "entname", "regcap", "entindustry").first().to_json())
        childrens = json.loads(Entsrelation.objects(entsource=lcid).only("enttarget", "entname", "entsource").to_json())
        obj["investment"] = json.loads(Entprerelation.objects(enttarget=lcid).only("entpre", "conprop").to_json())

        for relent in childrens:
            if Enterprise.objects(lcid=relent["enttarget"]).first() is not None:
                obj["children"].append(relent)
        self.rawdata.append(obj)
        # 自动递归
        if len(obj["children"]):
            for relent in obj["children"]:
                    self.getRelEnts(relent["enttarget"])