|
@@ -1,4 +1,4 @@
|
|
-import { Config, Provide } from '@midwayjs/core';
|
|
|
|
|
|
+import { Config, Inject, Provide } from '@midwayjs/core';
|
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
|
import { InjectEntityModel } from '@midwayjs/typeorm';
|
|
import { Repository } from 'typeorm';
|
|
import { Repository } from 'typeorm';
|
|
import { ExportMission } from '../entity/exportMission.entity';
|
|
import { ExportMission } from '../entity/exportMission.entity';
|
|
@@ -7,6 +7,7 @@ import Axios from 'axios';
|
|
import { cloneDeep, get, head, isArray } from 'lodash';
|
|
import { cloneDeep, get, head, isArray } from 'lodash';
|
|
import { User } from '../entity/system/user.entity';
|
|
import { User } from '../entity/system/user.entity';
|
|
import { Admin } from '../entity/system/admin.entity';
|
|
import { Admin } from '../entity/system/admin.entity';
|
|
|
|
+import { AsyncExportService } from './asyncExport.service';
|
|
|
|
|
|
@Provide()
|
|
@Provide()
|
|
export class ExportMissionService extends BaseServiceV2 {
|
|
export class ExportMissionService extends BaseServiceV2 {
|
|
@@ -18,6 +19,9 @@ export class ExportMissionService extends BaseServiceV2 {
|
|
@InjectEntityModel(Admin)
|
|
@InjectEntityModel(Admin)
|
|
admin: Repository<Admin>;
|
|
admin: Repository<Admin>;
|
|
|
|
|
|
|
|
+ @Inject()
|
|
|
|
+ aeService: AsyncExportService;
|
|
|
|
+
|
|
@Config('modulesConfig.mq')
|
|
@Config('modulesConfig.mq')
|
|
mqServiceHttpPrefix: any;
|
|
mqServiceHttpPrefix: any;
|
|
|
|
|
|
@@ -28,7 +32,7 @@ export class ExportMissionService extends BaseServiceV2 {
|
|
if (isArr) list = data;
|
|
if (isArr) list = data;
|
|
else list.push(data);
|
|
else list.push(data);
|
|
for (const i of list) {
|
|
for (const i of list) {
|
|
- const obj = cloneDeep(i)
|
|
|
|
|
|
+ const obj = cloneDeep(i);
|
|
const { user_type, user } = i;
|
|
const { user_type, user } = i;
|
|
let model;
|
|
let model;
|
|
if (user_type === 'ADMIN') {
|
|
if (user_type === 'ADMIN') {
|
|
@@ -42,7 +46,15 @@ export class ExportMissionService extends BaseServiceV2 {
|
|
const userInfo = await model.createQueryBuilder().where(`"id" =:id`, { id: user }).getOne();
|
|
const userInfo = await model.createQueryBuilder().where(`"id" =:id`, { id: user }).getOne();
|
|
if (!userInfo) continue;
|
|
if (!userInfo) continue;
|
|
obj.user_name = get(userInfo, 'nick_name');
|
|
obj.user_name = get(userInfo, 'nick_name');
|
|
- returnData.push(obj)
|
|
|
|
|
|
+ const config = get(i, 'config');
|
|
|
|
+ if (config) {
|
|
|
|
+ const table = get(config, 'table');
|
|
|
|
+ if (table) {
|
|
|
|
+ const table_name = this.aeService.getModelName(table);
|
|
|
|
+ obj.table_name = table_name;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ returnData.push(obj);
|
|
}
|
|
}
|
|
if (isArr) return returnData;
|
|
if (isArr) return returnData;
|
|
else return head(returnData);
|
|
else return head(returnData);
|