'use strict'; const Controller = require('egg').Controller; const { CrudController } = require('naf-framework-mongoose/lib/controller'); const meta = require('./.index.js'); // 首页-数据动态统计 class IndexController extends Controller { constructor(ctx) { super(ctx); this.service = this.ctx.service.statistics.index; } async index() { const patent = await this.service.patent(this.ctx.query); const product = await this.service.product(this.ctx.query); const expert = await this.service.expert(this.ctx.query); const circle = await this.service.circle(this.ctx.query); this.ctx.ok({ data: { patent, product, expert, circle } }); } /** * 首页专利统计 */ async patent() { const data = await this.service.patent(this.ctx.query); this.ctx.ok({ data }); } /** * 首页成果统计 */ async product() { const data = await this.service.product(this.ctx.query); this.ctx.ok({ data }); } /** * 首页成果统计 */ async expert() { const data = await this.service.expert(this.ctx.query); this.ctx.ok({ data }); } /** * 首页数据统计 */ async circle() { const data = await this.service.circle(this.ctx.query); this.ctx.ok({ data }); } async dockIndex() { const res = await this.service.dockIndex(this.ctx.query); this.ctx.ok({ data: res }); } /** * 企业数量统计 */ async orgCount() { const res = await this.ctx.service.users.organization.count(this.ctx.query); this.ctx.ok({ data: res }); } /** * 创新券申请统计 */ async policyApplyCount() { const data = await this.service.pac(); this.ctx.ok({ data }); } /** * 高企申报个步骤统计 */ async declare() { const data = await this.service.declare(); this.ctx.ok({ data }); } async dockProduct() { const query = this.ctx.query; const arr = ['skip', 'limit', 'dock_id']; for (const key in query) { const r = arr.find((f) => f === key); if (!r) { query[`productList.${key}`] = query[key]; delete query[key]; } } const data = await this.service.dockProduct(query); this.ctx.ok(data); } // 专利运营用户首页统计 async patentUserIndex() { const data = await this.service.patentUserIndex(this.ctx.query); this.ctx.ok({ data }); } /** * 根据申请人统计,申请人所在的专利信息数量 */ async patentInfoByApplyPerson() { const data = await this.service.patentInfoByApplyPerson(); this.ctx.ok({ data }); } } module.exports = CrudController(IndexController, meta);