|
@@ -1,11 +1,15 @@
|
|
|
-import { Controller, Get, Inject } from "@midwayjs/core";
|
|
|
+import { Controller, Get, Inject, Param } from "@midwayjs/core";
|
|
|
import { PartsService } from "../service/parts.service";
|
|
|
import { RF } from "../response/CustomerResponse";
|
|
|
+import { get } from "lodash";
|
|
|
+import { PageViewService } from "../service/v2/pageView.service";
|
|
|
|
|
|
@Controller('/xxgk', { tagName: '信息公开' })
|
|
|
export class XxgkController {
|
|
|
@Inject()
|
|
|
service: PartsService;
|
|
|
+ @Inject()
|
|
|
+ pageViewService: PageViewService;
|
|
|
|
|
|
@Get('/jgsz', { routerName: '机构设置' })
|
|
|
async jgsz() {
|
|
@@ -17,42 +21,48 @@ export class XxgkController {
|
|
|
async psgsxxgk() {
|
|
|
const channel_id = 212;
|
|
|
const data = await this.service.channelDetail(channel_id)
|
|
|
- return RF.success(data);
|
|
|
+ const newData = this.getViewContent(data)
|
|
|
+ return RF.success(newData);
|
|
|
}
|
|
|
|
|
|
@Get('/schjxxgk', { routerName: '水厂环境信息公开' })
|
|
|
async schjxxgk() {
|
|
|
const channel_id = 213;
|
|
|
const data = await this.service.channelDetail(channel_id)
|
|
|
- return RF.success(data);
|
|
|
+ const newData = this.getViewContent(data)
|
|
|
+ return RF.success(newData);
|
|
|
}
|
|
|
|
|
|
@Get('/xyzl', { routerName: '行业自律' })
|
|
|
async xyzl() {
|
|
|
const channel_id = 214;
|
|
|
const data = await this.service.channelDetail(channel_id)
|
|
|
- return RF.success(data);
|
|
|
+ const newData = this.getViewContent(data)
|
|
|
+ return RF.success(newData);
|
|
|
}
|
|
|
|
|
|
- @Get('/ccswjt2018nzfxxgkndgzbg', { routerName: '长春水务集团2018年政府信息公开年度工作报告' })
|
|
|
+ @Get('/sw2018', { routerName: '长春水务集团2018年政府信息公开年度工作报告' })
|
|
|
async ccswjt2018nzfxxgkndgzbg() {
|
|
|
const channel_id = 215;
|
|
|
const data = await this.service.channelDetail(channel_id)
|
|
|
- return RF.success(data);
|
|
|
+ const newData = this.getViewContent(data)
|
|
|
+ return RF.success(newData);
|
|
|
}
|
|
|
|
|
|
- @Get('/ccswjt2019ngz', { routerName: '长春水务集团2019年工作' })
|
|
|
+ @Get('/sw2019', { routerName: '长春水务集团2019年工作' })
|
|
|
async ccswjt2019ngz() {
|
|
|
const channel_id = 216;
|
|
|
const data = await this.service.channelDetail(channel_id)
|
|
|
- return RF.success(data);
|
|
|
+ const newData = this.getViewContent(data)
|
|
|
+ return RF.success(newData);
|
|
|
}
|
|
|
|
|
|
@Get('/zhswfw', { routerName: '智慧水务(互联网+供水服务)' })
|
|
|
async zhswfw() {
|
|
|
const channel_id = 217;
|
|
|
const data = await this.service.channelDetail(channel_id)
|
|
|
- return RF.success(data);
|
|
|
+ const newData = this.getViewContent(data)
|
|
|
+ return RF.success(newData);
|
|
|
}
|
|
|
/**
|
|
|
* 只有获得用水是channel的数据,剩下的几个都显示的是content列表
|
|
@@ -61,7 +71,8 @@ export class XxgkController {
|
|
|
async hdysz() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('hdysz')
|
|
|
const channelData = await this.service.channelDetail(channel_id);
|
|
|
- return RF.success(channelData)
|
|
|
+ const newData = this.getViewContent(channelData);
|
|
|
+ return RF.success(newData)
|
|
|
}
|
|
|
|
|
|
@Get('/zhswz', { routerName: '智慧水务' })
|
|
@@ -81,78 +92,116 @@ export class XxgkController {
|
|
|
@Get('/yscsz', { routerName: '用水常识' })
|
|
|
async yscsz() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('yscsz')
|
|
|
- const contentList = await this.service.contentList(channel_id)
|
|
|
- return RF.success(contentList)
|
|
|
+ const { data, total } = await this.service.contentList(channel_id)
|
|
|
+ const newList = this.getViewListContent(data)
|
|
|
+ return RF.success({ data: newList, total })
|
|
|
}
|
|
|
|
|
|
@Get('/xqyshj', { routerName: '新区营商环境' })
|
|
|
async xqyshj() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('xqyshj')
|
|
|
- const contentList = await this.service.contentList(channel_id)
|
|
|
- return RF.success(contentList)
|
|
|
+ const { data, total } = await this.service.contentList(channel_id)
|
|
|
+ const newList = this.getViewListContent(data)
|
|
|
+ return RF.success({ data: newList, total })
|
|
|
}
|
|
|
|
|
|
@Get('/fwxx', { routerName: '服务信息' })
|
|
|
async fwxx() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('fwxx')
|
|
|
const channelData = await this.service.channelDetail(channel_id);
|
|
|
- return RF.success(channelData)
|
|
|
+ const newData = this.getViewContent(channelData);
|
|
|
+ return RF.success(newData)
|
|
|
}
|
|
|
|
|
|
@Get('/fwxm', { routerName: '服务项目' })
|
|
|
async fwxm() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('fwxm')
|
|
|
const channelData = await this.service.channelDetail(channel_id);
|
|
|
- return RF.success(channelData)
|
|
|
+ const newData = this.getViewContent(channelData);
|
|
|
+ return RF.success(newData)
|
|
|
}
|
|
|
|
|
|
@Get('/fwsf', { routerName: '服务收费' })
|
|
|
async fwsf() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('fwsf')
|
|
|
const channelData = await this.service.channelDetail(channel_id);
|
|
|
- return RF.success(channelData)
|
|
|
+ const newData = this.getViewContent(channelData);
|
|
|
+ return RF.success(newData)
|
|
|
}
|
|
|
|
|
|
@Get('/fwjd', { routerName: '服务监督' })
|
|
|
async fwjd() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('fwjd')
|
|
|
const channelData = await this.service.channelDetail(channel_id);
|
|
|
- return RF.success(channelData)
|
|
|
+ const newData = this.getViewContent(channelData);
|
|
|
+ return RF.success(newData)
|
|
|
}
|
|
|
|
|
|
@Get('/yjfwya', { routerName: '应急服务预案' })
|
|
|
async yjfwya() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('yjfwya')
|
|
|
const channelData = await this.service.channelDetail(channel_id);
|
|
|
- return RF.success(channelData)
|
|
|
+ const newData = this.getViewContent(channelData);
|
|
|
+ return RF.success(newData)
|
|
|
}
|
|
|
|
|
|
@Get('/jcxxgk', { routerName: '决策信息公开' })
|
|
|
async jcxxgk() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('jcxxgk')
|
|
|
const channelData = await this.service.channelDetail(channel_id);
|
|
|
- return RF.success(channelData)
|
|
|
+ const newData = this.getViewContent(channelData);
|
|
|
+ return RF.success(newData)
|
|
|
}
|
|
|
|
|
|
@Get('/zyzclsqk', { routerName: '重要政策落实情况' })
|
|
|
async zyzclsqk() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('zyzclsqk')
|
|
|
const channelData = await this.service.channelDetail(channel_id);
|
|
|
- return RF.success(channelData)
|
|
|
+ const newData = this.getViewContent(channelData);
|
|
|
+ return RF.success(newData)
|
|
|
}
|
|
|
|
|
|
@Get('/qyscjyqk', { routerName: '企业生产经营情况' })
|
|
|
async qyscjyqk() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('qyscjyqk')
|
|
|
const channelData = await this.service.channelDetail(channel_id);
|
|
|
- return RF.success(channelData)
|
|
|
+ const newData = this.getViewContent(channelData);
|
|
|
+ return RF.success(newData)
|
|
|
}
|
|
|
|
|
|
@Get('/qyyxdrdzyjjfs', { routerName: '企业与相对人的争议解决方式' })
|
|
|
async qyyxdrdzyjjfs() {
|
|
|
const channel_id = await this.service.searchChannelIdByCode('qyyxdrdzyjjfs')
|
|
|
const channelData = await this.service.channelDetail(channel_id);
|
|
|
- return RF.success(channelData)
|
|
|
+ const newData = this.getViewContent(channelData);
|
|
|
+ return RF.success(newData)
|
|
|
+ }
|
|
|
+ @Get('/detail/:content_id', { routerName: '信息公开详情' })
|
|
|
+ async detail(@Param('content_id') content_id: string) {
|
|
|
+ const data: any = await this.service.contentDetail(content_id)
|
|
|
+ // TODO:增加浏览量,然后将浏览量放到返回数据中
|
|
|
+ const views = await this.pageViewService.fetch(content_id)
|
|
|
+ data.views = views;
|
|
|
+ return RF.success(data);
|
|
|
}
|
|
|
|
|
|
+ getViewContent(data: object) {
|
|
|
+ return {
|
|
|
+ channel_id: get(data, 'channel_id'),
|
|
|
+ title: get(data, 'channel_name'),
|
|
|
+ txt: get(data, 'txt.txt')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ getViewListContent(list: Array<any>) {
|
|
|
+ const newList = []
|
|
|
+ for (const i of list) {
|
|
|
+ const obj = {
|
|
|
+ content_id: get(i, 'content_id'),
|
|
|
+ title: get(i, 'ext.title'),
|
|
|
+ date: get(i, 'ext.release_date')
|
|
|
+ }
|
|
|
+ newList.push(obj)
|
|
|
+ }
|
|
|
+ return newList
|
|
|
+ }
|
|
|
}
|