midway-fatcms 0.0.1-beta.1 → 0.0.1-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/config/config.default.js +52 -15
  2. package/dist/controller/base/BaseApiController.js +9 -6
  3. package/dist/controller/gateway/CrudMtdGatewayController.js +3 -0
  4. package/dist/controller/gateway/DocGatewayController.js +13 -8
  5. package/dist/controller/gateway/StaticController.d.ts +3 -0
  6. package/dist/controller/gateway/StaticController.js +41 -21
  7. package/dist/controller/home.controller.js +2 -2
  8. package/dist/controller/manage/CrudStandardDesignApi.js +83 -68
  9. package/dist/controller/manage/DeployManageApi.js +6 -4
  10. package/dist/controller/manage/SuperAdminManageApi.js +12 -8
  11. package/dist/controller/manage/SysConfigMangeApi.js +3 -1
  12. package/dist/controller/manage/UserAccountManageApi.d.ts +1 -1
  13. package/dist/controller/manage/UserAccountManageApi.js +5 -0
  14. package/dist/controller/myinfo/AuthController.d.ts +0 -4
  15. package/dist/controller/myinfo/AuthController.js +0 -53
  16. package/dist/controller/render/AppRenderController.js +4 -2
  17. package/dist/index.d.ts +28 -4
  18. package/dist/index.js +28 -4
  19. package/dist/libs/global-config/global-config.d.ts +39 -0
  20. package/dist/libs/global-config/global-config.js +32 -0
  21. package/dist/models/SystemTables.d.ts +0 -3
  22. package/dist/models/SystemTables.js +1 -4
  23. package/dist/service/AuthService.js +8 -5
  24. package/dist/service/EnumInfoService.js +7 -4
  25. package/dist/service/FileCenterService.js +13 -9
  26. package/dist/service/SysConfigService.js +4 -2
  27. package/dist/service/UserAccountService.js +10 -6
  28. package/dist/service/VisitStatService.js +4 -2
  29. package/dist/service/WorkbenchService.js +4 -2
  30. package/dist/service/anyapi/AnyApiService.js +4 -2
  31. package/dist/service/crudstd/CrudStdService.js +6 -2
  32. package/dist/service/curd/CurdMixByAccountService.js +12 -6
  33. package/dist/service/curd/CurdMixByDictService.js +4 -2
  34. package/dist/service/curd/CurdMixBySysConfigService.js +4 -2
  35. package/dist/service/curd/CurdMixByWorkbenchService.js +4 -2
  36. package/dist/service/curd/CurdMixUtils.d.ts +7 -0
  37. package/dist/service/curd/CurdMixUtils.js +31 -1
  38. package/dist/service/proxyapi/ProxyApiLoadService.js +7 -4
  39. package/dist/views/404_app.html +31 -0
  40. package/dist/views/404_workbench.html +34 -0
  41. package/dist/views/static/favicon.ico +0 -0
  42. package/package.json +5 -1
  43. package/src/config/config.default.ts +58 -27
  44. package/src/controller/base/BaseApiController.ts +13 -13
  45. package/src/controller/gateway/CrudMtdGatewayController.ts +5 -1
  46. package/src/controller/gateway/DocGatewayController.ts +9 -1
  47. package/src/controller/gateway/StaticController.ts +50 -25
  48. package/src/controller/home.controller.ts +8 -10
  49. package/src/controller/manage/CrudStandardDesignApi.ts +139 -94
  50. package/src/controller/manage/DeployManageApi.ts +4 -1
  51. package/src/controller/manage/SuperAdminManageApi.ts +11 -2
  52. package/src/controller/manage/SysConfigMangeApi.ts +4 -1
  53. package/src/controller/manage/UserAccountManageApi.ts +6 -0
  54. package/src/controller/myinfo/AuthController.ts +4 -66
  55. package/src/controller/render/AppRenderController.ts +17 -14
  56. package/src/index.ts +33 -4
  57. package/src/libs/global-config/global-config.ts +72 -0
  58. package/src/models/SystemTables.ts +0 -4
  59. package/src/service/AuthService.ts +11 -6
  60. package/src/service/EnumInfoService.ts +6 -1
  61. package/src/service/FileCenterService.ts +8 -2
  62. package/src/service/SysConfigService.ts +9 -5
  63. package/src/service/UserAccountService.ts +11 -1
  64. package/src/service/VisitStatService.ts +5 -1
  65. package/src/service/WorkbenchService.ts +6 -1
  66. package/src/service/anyapi/AnyApiService.ts +4 -1
  67. package/src/service/crudstd/CrudStdService.ts +11 -1
  68. package/src/service/curd/CurdMixByAccountService.ts +13 -5
  69. package/src/service/curd/CurdMixByDictService.ts +7 -1
  70. package/src/service/curd/CurdMixBySysConfigService.ts +6 -1
  71. package/src/service/curd/CurdMixByWorkbenchService.ts +5 -1
  72. package/src/service/curd/CurdMixUtils.ts +42 -12
  73. package/src/service/proxyapi/ProxyApiLoadService.ts +9 -1
  74. package/src/views/404_app.html +31 -0
  75. package/src/views/404_workbench.html +34 -0
  76. package/src/views/static/favicon.ico +0 -0
  77. package/dist/controller/medstatistic/MedAdminController.d.ts +0 -35
  78. package/dist/controller/medstatistic/MedAdminController.js +0 -205
  79. package/dist/controller/medstatistic/MedClientController.d.ts +0 -28
  80. package/dist/controller/medstatistic/MedClientController.js +0 -188
  81. package/dist/controller/medstatistic/MedMessageService.d.ts +0 -19
  82. package/dist/controller/medstatistic/MedMessageService.js +0 -95
  83. package/dist/controller/medstatistic/MedScoreService.d.ts +0 -21
  84. package/dist/controller/medstatistic/MedScoreService.js +0 -107
  85. package/dist/controller/medstatistic/constants.d.ts +0 -32
  86. package/dist/controller/medstatistic/constants.js +0 -43
  87. package/src/controller/medstatistic/MedAdminController.ts +0 -221
  88. package/src/controller/medstatistic/MedClientController.ts +0 -188
  89. package/src/controller/medstatistic/MedMessageService.ts +0 -89
  90. package/src/controller/medstatistic/MedScoreService.ts +0 -108
  91. package/src/controller/medstatistic/constants.ts +0 -63
package/src/index.ts CHANGED
@@ -30,10 +30,6 @@ export * from './controller/manage/SysConfigMangeApi';
30
30
  export * from './controller/manage/SystemInfoManageApi';
31
31
  export * from './controller/manage/UserAccountManageApi';
32
32
  export * from './controller/manage/WorkbenchMangeApi';
33
- export * from './controller/medstatistic/MedAdminController';
34
- export * from './controller/medstatistic/MedClientController';
35
- export * from './controller/medstatistic/MedMessageService';
36
- export * from './controller/medstatistic/MedScoreService';
37
33
  export * from './controller/myinfo/AuthController';
38
34
  export * from './controller/myinfo/MyInfoController';
39
35
  export * from './controller/render/AppRenderController';
@@ -43,6 +39,7 @@ export * from './filter/notfound.filter';
43
39
  export * from './middleware/forbidden.middleware';
44
40
  export * from './middleware/global.middleware';
45
41
  export * from './middleware/tx.middleware';
42
+ export * from './middleware/permission.middleware';
46
43
  export * from './service/AuthService';
47
44
  export * from './service/EnumInfoService';
48
45
  export * from './service/FileCenterService';
@@ -68,3 +65,35 @@ export * from './service/curd/CurdMixService';
68
65
  export * from './service/curd/CurdProService';
69
66
  export * from './service/proxyapi/ProxyApiLoadService';
70
67
  export * from './service/proxyapi/ProxyApiService';
68
+ export * from './models/userSession';
69
+ export * from './models/bizmodels';
70
+ export * from './models/SystemEntities';
71
+ export * from './models/SystemPerm';
72
+ export * from './models/contextLogger';
73
+ export * from './models/devops';
74
+ export * from './models/SystemTables';
75
+
76
+
77
+ export * from './libs/utils/common-dto';
78
+ export * from './libs/utils/crypto-utils';
79
+ export * from './libs/utils/fatcms-request';
80
+ export * from './libs/utils/functions';
81
+ export * from './libs/utils/ordernum-utils';
82
+ export * from './libs/utils/parseConfig';
83
+
84
+ export * from './libs/crud-pro/CrudPro';
85
+ export * from './libs/crud-pro/defaultConfigs';
86
+ export * from './libs/crud-pro/exceptions';
87
+ export * from './libs/crud-pro/interfaces';
88
+
89
+ export * from './libs/crud-pro/models/ExecuteContext';
90
+ export * from './libs/crud-pro/models/FuncContext';
91
+ export * from './libs/crud-pro/models/RequestModel';
92
+ export * from './libs/crud-pro/models/SqlCfgModel';
93
+ export * from './libs/crud-pro/models/Transaction';
94
+ export * from './libs/crud-pro/models/keys';
95
+ export * from './libs/crud-pro/models/ExecuteContextFunc';
96
+ export * from './libs/crud-pro/models/RequestCfgModel';
97
+ export * from './libs/crud-pro/models/SqlSegArg';
98
+
99
+ export * from './libs/global-config/global-config';
@@ -0,0 +1,72 @@
1
+ import { SqlDbType } from '../crud-pro/models/keys';
2
+
3
+ interface IGlobalStaticConfig {
4
+ /**
5
+ * CrudStd: 业务系统自定义的修改cfgModel
6
+ * @param reqJson
7
+ * @param cfgModel
8
+ * @param appInfo
9
+ * @param ctx
10
+ */
11
+ bizUpdateCfgModelForCrudStd(reqJson: any, cfgModel: any, appInfo: any, ctx: any): Promise<any>;
12
+
13
+ /**
14
+ * CrudMtd: 业务系统自定义的修改cfgModel
15
+ * @param reqJson
16
+ * @param cfgModel
17
+ * @param methodInfo
18
+ * @param ctx
19
+ */
20
+ bizUpdateCfgModelForCrudMtd(reqJson: any, cfgModel: any, methodInfo: any, ctx: any): Promise<any>;
21
+
22
+
23
+ /**
24
+ * 生成用户的账号ID,业务系统可以生成类似工号的ID
25
+ * @param userSubmitData
26
+ */
27
+ generateUserAccountId(userSubmitData: any): Promise<string>;
28
+
29
+
30
+ /**
31
+ * 将业务系统表中的userId映射为fatcms的UserAccountId
32
+ * @param bizTableUserId 业余系统表中的UserId
33
+ */
34
+ toFatcmsUserAccountId(bizTableUserId: any): string;
35
+
36
+ SystemDbName: string;
37
+ SystemDbType: SqlDbType;
38
+ }
39
+
40
+ const noop = () => {
41
+ return Promise.resolve();
42
+ };
43
+
44
+ class GlobalStaticConfig {
45
+ private configObject: IGlobalStaticConfig;
46
+ constructor() {
47
+ this.configObject = {
48
+ bizUpdateCfgModelForCrudStd: noop,
49
+ bizUpdateCfgModelForCrudMtd: noop,
50
+ generateUserAccountId: null,
51
+ toFatcmsUserAccountId: (bizTableUserId: any) => {
52
+ return bizTableUserId;
53
+ },
54
+ SystemDbName: 'fatcms',
55
+ SystemDbType: SqlDbType.mysql,
56
+ };
57
+ }
58
+ public getConfig(): IGlobalStaticConfig {
59
+ return this.configObject as IGlobalStaticConfig;
60
+ }
61
+
62
+ public setConfig(configObject: any) {
63
+ if (!configObject || typeof configObject !== 'object') {
64
+ throw new Error('参数configObject不能为空');
65
+ }
66
+ Object.assign(this.configObject, configObject);
67
+ }
68
+ }
69
+
70
+ const GLOBAL_STATIC_CONFIG = new GlobalStaticConfig();
71
+
72
+ export { GLOBAL_STATIC_CONFIG };
@@ -1,5 +1,3 @@
1
- import {SqlDbType} from "../libs/crud-pro/models/keys";
2
-
3
1
  export const SystemTables = {
4
2
  sys_workbench: 'sys_workbench',
5
3
  sys_user_account: 'sys_user_account',
@@ -24,7 +22,5 @@ export const SystemTables = {
24
22
  sys_visit_stats: 'sys_visit_stats',
25
23
  };
26
24
 
27
- export const SystemDbName = 'fatcms';
28
- export const SystemDbType = SqlDbType.mysql;
29
25
 
30
26
  export const SystemDevOpsWorkbench = 'devops';
@@ -5,12 +5,13 @@ import { CurdMixService } from './curd/CurdMixService';
5
5
  import * as md5 from 'md5';
6
6
  import { UserAccountService } from './UserAccountService';
7
7
  import { createUniqueId } from '../libs/utils/functions';
8
- import {IConsumerUserInfo, ISessionInfo, SYS_ACCOUNT_TYPE} from '../models/userSession';
9
- import {SystemDbName, SystemDbType, SystemTables} from '../models/SystemTables';
8
+ import { IConsumerUserInfo, ISessionInfo, SYS_ACCOUNT_TYPE } from '../models/userSession';
9
+ import { SystemTables } from '../models/SystemTables';
10
10
  import { UserSessionService } from './UserSessionService';
11
11
  import { CommonResult } from '../libs/utils/common-dto';
12
12
  import { isEnableSuperAdmin } from "../libs/utils/fatcms-request";
13
- import {CommonException} from "../libs/crud-pro/exceptions";
13
+ import { CommonException } from "../libs/crud-pro/exceptions";
14
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
14
15
 
15
16
  @Provide()
16
17
  export class AuthService {
@@ -94,7 +95,7 @@ export class AuthService {
94
95
  nickName: consumerUserInfo.nickName,
95
96
  avatar: consumerUserInfo.avatar,
96
97
  roleCodes: [],
97
- functionCodes:[],
98
+ functionCodes: [],
98
99
  loginName: consumerUserInfo.loginName,
99
100
  sessionId,
100
101
  accountId: consumerUserInfo.accountId,
@@ -141,7 +142,7 @@ export class AuthService {
141
142
  sessionId,
142
143
  accountId,
143
144
  workbenchCode,
144
- accountType: SYS_ACCOUNT_TYPE
145
+ accountType: SYS_ACCOUNT_TYPE,
145
146
  };
146
147
 
147
148
  await this.userSessionService.saveUserSession(sessionInfo);
@@ -203,6 +204,8 @@ export class AuthService {
203
204
  * @private
204
205
  */
205
206
  private async queryUserRoleCodeList(accountId: string): Promise<string[]> {
207
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
208
+
206
209
  const res = await this.curdMixService.executeCrudByCfg(
207
210
  {
208
211
  condition: { account_id: accountId },
@@ -232,6 +235,8 @@ export class AuthService {
232
235
  return [];
233
236
  }
234
237
 
238
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
239
+
235
240
  const res = await this.curdMixService.executeCrudByCfg(
236
241
  {
237
242
  condition: { role_code: { $in: roleCodeList } },
@@ -259,7 +264,7 @@ export class AuthService {
259
264
  const oldSessionId = sessionInfo.sessionId;
260
265
 
261
266
  const sessionId = createUniqueId();
262
- const newSessionInfo: ISessionInfo = {...sessionInfo, sessionId};
267
+ const newSessionInfo: ISessionInfo = { ...sessionInfo, sessionId };
263
268
 
264
269
  await this.userSessionService.saveUserSession(newSessionInfo);
265
270
 
@@ -3,10 +3,11 @@ import {Context} from '@midwayjs/koa';
3
3
  import {KeysOfSimpleSQL} from '../libs/crud-pro/models/keys';
4
4
  import {CurdProService} from './curd/CurdProService';
5
5
  import {RelatedType} from './curd/CurdMixUtils';
6
- import {SystemDbName, SystemDbType, SystemTables} from '../models/SystemTables';
6
+ import {SystemTables} from '../models/SystemTables';
7
7
  import {parseConfigContentToEnumInfo, IEnumInfo} from '../libs/utils/parseConfig';
8
8
  import {RedisCacheService} from "./base/RedisCacheService";
9
9
  import {CurdMixByLinkToCustomService} from "./curd/CurdMixByLinkToCustomService";
10
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
10
11
 
11
12
 
12
13
  interface IQueryEnumInfo {
@@ -88,6 +89,8 @@ export class EnumInfoService {
88
89
  }
89
90
 
90
91
  private async queryEnumInfoBySysCfgEnum(code: string): Promise<IEnumInfo[]> {
92
+ const {SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
93
+
91
94
  const res1 = await this.curdProService.executeCrudByCfg(
92
95
  {
93
96
  condition: { config_code: code },
@@ -109,6 +112,8 @@ export class EnumInfoService {
109
112
  }
110
113
 
111
114
  private async queryEnumInfoItemByDict(code: string): Promise<IEnumInfo[]> {
115
+ const {SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
116
+
112
117
  const res1 = await this.curdProService.executeCrudByCfg(
113
118
  {
114
119
  condition: { dict_code: code },
@@ -10,7 +10,7 @@ import { KeysOfSimpleSQL, KeysOfValidators } from '../libs/crud-pro/models/keys'
10
10
  import { AccessType, IEntityCommonInfo, UploadCategoryType } from '../models/bizmodels';
11
11
  import { IRequestCfgModel } from '../libs/crud-pro/interfaces';
12
12
  import { BaseService } from './base/BaseService';
13
- import {SystemDbName, SystemDbType} from '../models/SystemTables';
13
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
14
14
 
15
15
  function getSuffix(s: string): string {
16
16
  if (s) {
@@ -107,6 +107,8 @@ class FileDB {
107
107
  }
108
108
 
109
109
  async getFileInfo(fileKey: string): Promise<IFileInfo> {
110
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
111
+
110
112
  const condition: any = { file_key: fileKey };
111
113
  const cfgModel: IRequestCfgModel = {
112
114
  sqlTable: 'sys_file',
@@ -123,6 +125,8 @@ class FileDB {
123
125
  }
124
126
 
125
127
  async saveFileInfo(fileInfo: IFileInfo) {
128
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
129
+
126
130
  const cfgModel = {
127
131
  sqlTable: 'sys_file',
128
132
  sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
@@ -141,6 +145,7 @@ class FileDB {
141
145
  }
142
146
 
143
147
  async saveAssetsLog(fileInfo: IFileInfo) {
148
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
144
149
  const cfgModel = {
145
150
  sqlTable: 'sys_assets_log',
146
151
  sqlSimpleName: KeysOfSimpleSQL.SIMPLE_INSERT,
@@ -151,6 +156,7 @@ class FileDB {
151
156
  }
152
157
 
153
158
  async deleteFileInfo(id: number) {
159
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
154
160
  const cfgModel: IRequestCfgModel = {
155
161
  sqlTable: 'sys_file',
156
162
  sqlSimpleName: KeysOfSimpleSQL.SIMPLE_DELETE,
@@ -200,7 +206,7 @@ function toUploadOriginByReferer(referer: string): string {
200
206
  return 'doc-editor';
201
207
  }
202
208
  if (pathname.startsWith('/pages/devops/file-manage')) {
203
- return 'file-manage';
209
+ return 'file-manage';
204
210
  }
205
211
  } catch (error) {
206
212
  console.error('toUploadOriginByReferer', error);
@@ -1,9 +1,10 @@
1
1
  import { Inject, Provide } from '@midwayjs/core';
2
2
  import { Context } from '@midwayjs/koa';
3
- import { KeysOfSimpleSQL} from "../libs/crud-pro/models/keys";
4
- import {SystemDbName, SystemDbType, SystemTables} from "../models/SystemTables";
5
- import {BaseService} from "./base/BaseService";
6
- import {CurdProService} from "./curd/CurdProService";
3
+ import { KeysOfSimpleSQL } from "../libs/crud-pro/models/keys";
4
+ import { SystemTables } from "../models/SystemTables";
5
+ import { BaseService } from "./base/BaseService";
6
+ import { CurdProService } from "./curd/CurdProService";
7
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
7
8
 
8
9
  @Provide()
9
10
  export class SysConfigService extends BaseService {
@@ -14,9 +15,12 @@ export class SysConfigService extends BaseService {
14
15
  private curdProService: CurdProService;
15
16
 
16
17
  async getSysConfigOne(config_code: string): Promise<any> {
17
- if (!config_code){
18
+ if (!config_code) {
18
19
  throw new Error('[getSysConfigOne] config_code required');
19
20
  }
21
+
22
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
23
+
20
24
  const res1 = await this.curdProService.executeCrudByCfg(
21
25
  {
22
26
  condition: { config_code },
@@ -6,8 +6,9 @@ import { CurdMixService } from './curd/CurdMixService';
6
6
  import { createUniqueId } from '../libs/utils/functions';
7
7
  import { CommonException, Exceptions } from '../libs/crud-pro/exceptions';
8
8
  import { IRequestCfgModel, IRequestModel } from '../libs/crud-pro/interfaces';
9
- import {SystemDbName, SystemDbType, SystemTables} from '../models/SystemTables';
9
+ import {SystemTables} from '../models/SystemTables';
10
10
  import { CommonResult } from '../libs/utils/common-dto';
11
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
11
12
 
12
13
  @Provide()
13
14
  export class UserAccountService {
@@ -21,6 +22,9 @@ export class UserAccountService {
21
22
  * @param loginName
22
23
  */
23
24
  public async queryUserAccountByLoginName(loginName: string) {
25
+
26
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
27
+
24
28
  const query = await this.curdMixService.executeCrudByCfg(
25
29
  {
26
30
  condition: { login_name: loginName },
@@ -47,6 +51,9 @@ export class UserAccountService {
47
51
  return [];
48
52
  }
49
53
 
54
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
55
+
56
+
50
57
  const accountIds = accountIdList.map(userId => {
51
58
  return `${userId}`;
52
59
  });
@@ -81,6 +88,9 @@ export class UserAccountService {
81
88
  if (!loginName) {
82
89
  throw new CommonException(Exceptions.OTHER_EXCEPTION, 'loginName不存在');
83
90
  }
91
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
92
+
93
+
84
94
  const pwd_salt = createUniqueId();
85
95
  const pwd_md5 = md5(unsaltedPwd + pwd_salt);
86
96
  const res1 = await this.curdMixService.executeCrudByCfg(
@@ -3,10 +3,11 @@ import {Context} from '@midwayjs/koa';
3
3
  import {IScheduleService} from '../interface';
4
4
  import {BaseService} from "./base/BaseService";
5
5
  import {CurdProService} from "./curd/CurdProService";
6
- import {SystemDbName, SystemDbType, SystemTables} from "../models/SystemTables";
6
+ import { SystemTables} from "../models/SystemTables";
7
7
  import {KeysOfSimpleSQL} from "../libs/crud-pro/models/keys";
8
8
  import {FILE_GET_TYPES} from "../models/bizmodels";
9
9
  import {CommonResult} from "../libs/utils/common-dto";
10
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
10
11
 
11
12
 
12
13
  // 3天 的秒数
@@ -35,6 +36,9 @@ export class VisitStatService extends BaseService implements IScheduleService {
35
36
 
36
37
 
37
38
  async flushVisitStatToDB(): Promise<any> {
39
+
40
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
41
+
38
42
  // 统计昨天的数据。
39
43
  const stat_date = new Date(Date.now() - 24 * 3600 * 1000).toISOString().split('T')[0];
40
44
 
@@ -1,7 +1,7 @@
1
1
  import { Inject, Provide } from '@midwayjs/core';
2
2
  import { Context } from '@midwayjs/koa';
3
3
  import { KeysOfSimpleSQL } from '../libs/crud-pro/models/keys';
4
- import {SystemDbName, SystemDbType, SystemTables} from '../models/SystemTables';
4
+ import { SystemTables} from '../models/SystemTables';
5
5
  import { BaseService } from './base/BaseService';
6
6
  // import { LRUCache } from 'lru-cache';
7
7
  import { CurdProService } from './curd/CurdProService';
@@ -11,6 +11,7 @@ import { IWorkbenchEntity } from '../models/SystemEntities';
11
11
  import { IScheduleService } from '../interface';
12
12
  import { getDebugWorkbenchCode } from '../libs/utils/fatcms-request';
13
13
  import { MixinUtils } from '../libs/crud-pro/utils/MixinUtils';
14
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
14
15
  //
15
16
  // const lruCache = new LRUCache<string, any>({
16
17
  // max: 500,
@@ -42,6 +43,10 @@ export class WorkbenchService extends BaseService implements IScheduleService {
42
43
  }
43
44
 
44
45
  public async getAllWorkbenchInfoList(isForceRefresh?: boolean): Promise<IWorkbenchEntity[]> {
46
+
47
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
48
+
49
+
45
50
  let listData = lruCache.get(CACHE_KEY_WORKBENCH_LIST);
46
51
  if (!listData || isForceRefresh === true) {
47
52
  const reqJson = { condition: {}, pageSize: 1000, limit: 1000 };
@@ -1,7 +1,7 @@
1
1
  import { Inject, Provide } from '@midwayjs/core';
2
2
  import { Context } from '@midwayjs/koa';
3
3
  import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
4
- import {SystemDbName, SystemDbType, SystemTables} from '../../models/SystemTables';
4
+ import { SystemTables} from '../../models/SystemTables';
5
5
  import { LRUCache } from 'lru-cache';
6
6
  import { BizException } from '../../models/devops';
7
7
  import { CurdMixService } from '../curd/CurdMixService';
@@ -13,6 +13,7 @@ import { MixinUtils } from '../../libs/crud-pro/utils/MixinUtils';
13
13
  import { WorkbenchService } from '../WorkbenchService';
14
14
  import { validateByCfgString } from '../../libs/crud-pro/utils/ValidateUtils';
15
15
  import { API_BASE_TYPE, ApiBaseService } from '../base/ApiBaseService';
16
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
16
17
 
17
18
  const lruCache = new LRUCache<string, any>({
18
19
  max: 500,
@@ -80,6 +81,8 @@ export class AnyApiService extends ApiBaseService {
80
81
  }
81
82
 
82
83
  private async _getAnyApiMethod(methodCode: string): Promise<ISysAnyApiEntity> {
84
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
85
+
83
86
  const res = await this.curdMixService.executeCrudByCfg(
84
87
  { condition: { method: methodCode } },
85
88
  {
@@ -7,12 +7,13 @@ import { parseJsonObject } from '../../libs/utils/functions';
7
7
  import { ICrudStdAppInfo, ICrudStdAppInfoForSettingKey } from '../../models/bizmodels';
8
8
  import { BizException } from '../../models/devops';
9
9
  import { ExecuteContext } from '../../libs/crud-pro/models/ExecuteContext';
10
- import {SystemDbName, SystemDbType, SystemTables} from '../../models/SystemTables';
10
+ import { SystemTables} from '../../models/SystemTables';
11
11
  import { CrudStdActionService } from './CrudStdActionService';
12
12
  import { CrudStdRelationService } from './CrudStdRelationService';
13
13
  import * as _ from 'lodash';
14
14
  import { ApiBaseService } from '../base/ApiBaseService';
15
15
  import {parseDatabaseName} from "../../libs/crud-pro/utils/DatabaseName";
16
+ import { GLOBAL_STATIC_CONFIG } from '../../libs/global-config/global-config';
16
17
 
17
18
  export const SPECIAL_SETTING_KEY = {
18
19
  QUERY_LIST: 'QUERY_LIST',
@@ -67,6 +68,10 @@ export class CrudStdService extends ApiBaseService {
67
68
 
68
69
  // 根据用户配置,设置关联查询的数据信息。
69
70
  await this.crudStdRelationService.addCfgModelColumnsRelation(cfgModel, appInfo);
71
+
72
+ // 业务系统自定义的修改cfgModel
73
+ await GLOBAL_STATIC_CONFIG.getConfig().bizUpdateCfgModelForCrudStd(params, cfgModel, appInfo, this.ctx);
74
+
70
75
  return await this.curdMixService.executeCrudByCfg(params, cfgModel);
71
76
  }
72
77
 
@@ -133,6 +138,11 @@ export class CrudStdService extends ApiBaseService {
133
138
  * @private
134
139
  */
135
140
  private async getCrudStdAppInfo(appCode?: string) {
141
+
142
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
143
+
144
+
145
+
136
146
  this.logInfo('getCrudStdAppInfo', appCode);
137
147
 
138
148
  const ss = {
@@ -4,10 +4,11 @@ import * as _ from 'lodash';
4
4
  import { CurdProService } from './CurdProService';
5
5
  import { ExecuteContext, IExecuteContextHandler } from '../../libs/crud-pro/models/ExecuteContext';
6
6
  import { CrudMixUtils, RelatedType } from './CurdMixUtils';
7
- import {SystemDbName, SystemDbType, SystemTables} from '../../models/SystemTables';
7
+ import { SystemTables } from '../../models/SystemTables';
8
8
  import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
9
9
  import { ColumnRelation, IRequestCfgModel, IRequestModel } from '../../libs/crud-pro/interfaces';
10
10
  import { MixinUtils } from '../../libs/crud-pro/utils/MixinUtils';
11
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
11
12
 
12
13
  const dictMixUtils = new CrudMixUtils(RelatedType.accountBasic);
13
14
 
@@ -22,6 +23,8 @@ export class CurdMixByAccountService implements IExecuteContextHandler {
22
23
  protected curdProService: CurdProService;
23
24
 
24
25
  async handleExecuteContextPrepare(executeContext: ExecuteContext) {
26
+ const { SystemDbName, SystemDbType, toFatcmsUserAccountId } = GLOBAL_STATIC_CONFIG.getConfig();
27
+
25
28
  const relations = dictMixUtils.pickColumnRelations(executeContext);
26
29
  if (!relations || relations.length === 0) {
27
30
  return;
@@ -30,10 +33,15 @@ export class CurdMixByAccountService implements IExecuteContextHandler {
30
33
  const accountIds = new Set<string>();
31
34
  dictMixUtils.forEachRowAndColumnsRelation(executeContext, (row: any, columnRelation: ColumnRelation) => {
32
35
  const { sourceColumn } = columnRelation;
33
- const accountId = _.get(row, sourceColumn);
34
- if (accountId) {
35
- accountIds.add(accountId);
36
+ if (sourceColumn) {
37
+ const accountId = _.get(row, sourceColumn);
38
+ if (accountId) {
39
+ const fatcmsUserAccountId = toFatcmsUserAccountId(accountId);
40
+ accountIds.add(fatcmsUserAccountId);
41
+ row['__fatcmsUserAccountId__'] = fatcmsUserAccountId;
42
+ }
36
43
  }
44
+
37
45
  });
38
46
 
39
47
  if (accountIds.size === 0) {
@@ -77,7 +85,7 @@ export class CurdMixByAccountService implements IExecuteContextHandler {
77
85
  { from: 'avatar', to: `${sourceColumn}_user.avatar` },
78
86
  ];
79
87
  }
80
- dictMixUtils.copyColumnRelationToRowNoRelatedCode(row, userInfoMap, columnRelation);
88
+ dictMixUtils.copyUserInfoToRowNoRelatedCode(row, userInfoMap, columnRelation);
81
89
  });
82
90
  }
83
91
  }
@@ -3,12 +3,13 @@ import { Context } from '@midwayjs/koa';
3
3
  import { CurdProService } from './CurdProService';
4
4
  import { ExecuteContext, IExecuteContextHandler } from '../../libs/crud-pro/models/ExecuteContext';
5
5
  import { CrudMixUtils, RelatedType } from './CurdMixUtils';
6
- import {SystemDbName, SystemDbType, SystemTables} from '../../models/SystemTables';
6
+ import { SystemTables} from '../../models/SystemTables';
7
7
  import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
8
8
  import { MultiKeyMap } from '../../libs/crud-pro/utils/MultiKeyMap';
9
9
  import { ColumnRelation } from '../../libs/crud-pro/interfaces';
10
10
  import * as _ from 'lodash';
11
11
  import {RedisCacheService} from "../base/RedisCacheService";
12
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
12
13
 
13
14
  const TMP_CTX_KEY = _.uniqueId('CurdMixByDictService');
14
15
 
@@ -46,6 +47,11 @@ export class CurdMixByDictService implements IExecuteContextHandler {
46
47
  }
47
48
 
48
49
  private async getDictItemRows(codes: string[]) {
50
+
51
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
52
+
53
+
54
+
49
55
  const noCacheCodes: string[] = [];
50
56
 
51
57
  // 从缓存里面取
@@ -4,11 +4,12 @@ import { CurdProService } from './CurdProService';
4
4
  import { ExecuteContext, IExecuteContextHandler } from '../../libs/crud-pro/models/ExecuteContext';
5
5
  import { CrudMixUtils, RelatedType } from './CurdMixUtils';
6
6
  import * as _ from 'lodash';
7
- import {SystemDbName, SystemDbType, SystemTables} from '../../models/SystemTables';
7
+ import { SystemTables} from '../../models/SystemTables';
8
8
  import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
9
9
  import { MultiKeyMap } from '../../libs/crud-pro/utils/MultiKeyMap';
10
10
  import { ColumnRelation } from '../../libs/crud-pro/interfaces';
11
11
  import { parseConfigContentToEnumInfo } from "../../libs/utils/parseConfig";
12
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
12
13
 
13
14
  const dictMixUtils = new CrudMixUtils(RelatedType.sysCfgEnum);
14
15
 
@@ -25,6 +26,10 @@ export class CurdMixBySysConfigService implements IExecuteContextHandler {
25
26
  protected curdProService: CurdProService;
26
27
 
27
28
  async handleExecuteContextPrepare(executeContext: ExecuteContext) {
29
+
30
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
31
+
32
+
28
33
  const codes = dictMixUtils.pickColumnRelationCodes(executeContext);
29
34
  if (!codes || codes.length === 0) {
30
35
  return;
@@ -5,10 +5,11 @@ import { LRUCache } from 'lru-cache';
5
5
  import { CurdProService } from './CurdProService';
6
6
  import { ExecuteContext, IExecuteContextHandler } from '../../libs/crud-pro/models/ExecuteContext';
7
7
  import { CrudMixUtils, RelatedType } from './CurdMixUtils';
8
- import {SystemDbName, SystemDbType, SystemTables} from '../../models/SystemTables';
8
+ import { SystemTables } from '../../models/SystemTables';
9
9
  import { KeysOfSimpleSQL } from '../../libs/crud-pro/models/keys';
10
10
  import { ColumnRelation } from '../../libs/crud-pro/interfaces';
11
11
  import { MixinUtils } from '../../libs/crud-pro/utils/MixinUtils';
12
+ import { GLOBAL_STATIC_CONFIG } from '@/libs/global-config/global-config';
12
13
 
13
14
  const lruCache = new LRUCache<string, any>({
14
15
  max: 500,
@@ -29,6 +30,9 @@ export class CurdMixByWorkbenchService implements IExecuteContextHandler {
29
30
  protected curdProService: CurdProService;
30
31
 
31
32
  private async loadWorkbenchListMap() {
33
+
34
+ const { SystemDbName, SystemDbType } = GLOBAL_STATIC_CONFIG.getConfig();
35
+
32
36
  let workbenchListMap = lruCache.get('workbenchListMap');
33
37
  if (!workbenchListMap) {
34
38
  const reqJson = {