├── .gitignore
├── LICENSE
├── dependencies
├── authoritymanager-1.1.jar
└── authoritymanager-1.1.pom
├── front
├── .babelrc
├── package-lock.json
├── package.json
├── postcss.config.js
├── src
│ ├── api
│ │ ├── index.js
│ │ ├── restApi.js
│ │ └── service
│ │ │ ├── appQuotaService.js
│ │ │ ├── appService.js
│ │ │ ├── applyService.js
│ │ │ ├── authService.js
│ │ │ ├── cloudService.js
│ │ │ ├── envService.js
│ │ │ ├── index.js
│ │ │ ├── orgService.js
│ │ │ ├── quotaService.js
│ │ │ ├── roleService.js
│ │ │ ├── specTypeService.js
│ │ │ ├── userService.js
│ │ │ └── zoneService.js
│ ├── assets
│ │ ├── css
│ │ │ ├── color-dark.css
│ │ │ ├── main.css
│ │ │ └── theme-green
│ │ │ │ ├── color-green.css
│ │ │ │ ├── fonts
│ │ │ │ ├── element-icons.ttf
│ │ │ │ └── element-icons.woff
│ │ │ │ └── index.css
│ │ └── img
│ │ │ └── dog.jpg
│ ├── common
│ │ ├── common.js
│ │ └── commonPlugin.js
│ ├── components
│ │ ├── AppList.vue
│ │ ├── AppQuotaList.vue
│ │ ├── ApplyList.vue
│ │ ├── EnvList.vue
│ │ ├── Introduction.vue
│ │ ├── Login.vue
│ │ ├── OrgList.vue
│ │ ├── QuotaList.vue
│ │ ├── RoleList.vue
│ │ ├── SpecTypeList.vue
│ │ ├── UserList.vue
│ │ ├── ZoneList.vue
│ │ └── layout
│ │ │ ├── Header.vue
│ │ │ ├── Home.vue
│ │ │ └── SideBar.vue
│ ├── index.html
│ ├── main.js
│ ├── router
│ │ └── index.js
│ ├── store
│ │ ├── index.js
│ │ ├── modules
│ │ │ ├── appQuotaStore.js
│ │ │ ├── appStore.js
│ │ │ ├── apply.js
│ │ │ ├── cloudStore.js
│ │ │ ├── envStore.js
│ │ │ ├── machineStore.js
│ │ │ ├── orgStore.js
│ │ │ ├── pauth.js
│ │ │ ├── quotaStore.js
│ │ │ ├── roleStore.js
│ │ │ ├── specTypeStore.js
│ │ │ ├── userStore.js
│ │ │ └── zoneStore.js
│ │ └── mutation-types.js
│ ├── utils
│ │ ├── dateUtil.js
│ │ ├── encryptUtil.js
│ │ ├── jwtTokenUtil.js
│ │ └── lastVisitedUtil.js
│ └── vendor.js
└── webpack.config.js
├── pom.xml
└── src
├── main
├── java
│ └── com
│ │ └── ppdai
│ │ └── atlas
│ │ ├── AtlasApplication.java
│ │ ├── aop
│ │ ├── AuditLogAspect.java
│ │ ├── ExceptionAspect.java
│ │ └── ResourcePointCuts.java
│ │ ├── client
│ │ └── JsonHttpClient.java
│ │ ├── common
│ │ ├── exception
│ │ │ └── AtlasServiceException.java
│ │ └── utils
│ │ │ └── ConvertUtils.java
│ │ ├── config
│ │ ├── HttpClientBeanConfig.java
│ │ ├── JacksonConfig.java
│ │ ├── JpaConfiguration.java
│ │ ├── MappingConfiguration.java
│ │ ├── SwaggerConfiguration.java
│ │ └── UserAuditorAware.java
│ │ ├── controller
│ │ ├── AppController.java
│ │ ├── AppQuotaController.java
│ │ ├── ApplyController.java
│ │ ├── EnvController.java
│ │ ├── HSController.java
│ │ ├── OrgController.java
│ │ ├── QuotaController.java
│ │ ├── RoleController.java
│ │ ├── SpecTypeController.java
│ │ ├── UserController.java
│ │ ├── UserExtController.java
│ │ ├── UserRoleController.java
│ │ ├── ZoneController.java
│ │ └── response
│ │ │ ├── MessageType.java
│ │ │ └── Response.java
│ │ ├── dao
│ │ ├── AppQuotaRepository.java
│ │ ├── AppRepository.java
│ │ ├── ApplyRepository.java
│ │ ├── AuditLogRepository.java
│ │ ├── BaseJpaRepository.java
│ │ ├── EnvRepository.java
│ │ ├── LockRepository.java
│ │ ├── OrgRepository.java
│ │ ├── QuotaRepository.java
│ │ ├── RoleRepository.java
│ │ ├── SpecTypeRepository.java
│ │ ├── UserExtRepository.java
│ │ ├── UserRepository.java
│ │ ├── UserRoleRepository.java
│ │ └── ZoneRepository.java
│ │ ├── dto
│ │ ├── AlertNotifyDetailDto.java
│ │ ├── AppDto.java
│ │ ├── AppDtoPlus.java
│ │ ├── AppQuotaDto.java
│ │ ├── ApplyDto.java
│ │ ├── BaseDto.java
│ │ ├── DasPage.java
│ │ ├── EnvDto.java
│ │ ├── NewAppApplyDto.java
│ │ ├── OrgDto.java
│ │ ├── PageDto.java
│ │ ├── QuotaDto.java
│ │ ├── QuotaDtoPlus.java
│ │ ├── Response.java
│ │ ├── RoleDto.java
│ │ ├── SpecTypeDto.java
│ │ ├── UpdateApplyStatusDto.java
│ │ ├── UserDto.java
│ │ ├── UserExtDto.java
│ │ ├── UserRoleDto.java
│ │ ├── ZoneDto.java
│ │ └── query
│ │ │ ├── AppManagerQuery.java
│ │ │ ├── AppQuery.java
│ │ │ ├── AppQuotaQuery.java
│ │ │ ├── EnvQuery.java
│ │ │ ├── OrgQuery.java
│ │ │ ├── QuotaQuery.java
│ │ │ ├── QuotaSpectypeCheck.java
│ │ │ ├── RoleQuery.java
│ │ │ ├── SpecTypeItem.java
│ │ │ ├── SpecTypeQuery.java
│ │ │ └── UserQuery.java
│ │ ├── entity
│ │ ├── AppEntity.java
│ │ ├── AppQuotaEntity.java
│ │ ├── ApplyEntity.java
│ │ ├── AuditLogEntity.java
│ │ ├── BaseEntity.java
│ │ ├── EnvEntity.java
│ │ ├── LockEntity.java
│ │ ├── OrgEntity.java
│ │ ├── QuotaEntity.java
│ │ ├── RoleEntity.java
│ │ ├── SpecTypeEntity.java
│ │ ├── UserEntity.java
│ │ ├── UserExtEntity.java
│ │ ├── UserRoleEntity.java
│ │ ├── ZoneEntity.java
│ │ └── converter
│ │ │ ├── EnvUrl.java
│ │ │ ├── ListToJsonStringConverter.java
│ │ │ └── MapToStringConverter.java
│ │ ├── enums
│ │ ├── ApplyStatusEnum.java
│ │ ├── ApplyTypeEnum.java
│ │ └── EnvEnum.java
│ │ ├── exception
│ │ └── BaseException.java
│ │ ├── job
│ │ └── LdapUserJob.java
│ │ ├── manager
│ │ ├── AppManager.java
│ │ ├── AppQuotaManager.java
│ │ ├── EnvManager.java
│ │ ├── LdapManager.java
│ │ ├── LockManager.java
│ │ ├── OrgManager.java
│ │ ├── QuotaManager.java
│ │ ├── RoleManager.java
│ │ ├── SpecTypeManager.java
│ │ ├── UserExtManager.java
│ │ ├── UserManager.java
│ │ └── UserRoleManager.java
│ │ ├── service
│ │ ├── AppQuotaService.java
│ │ ├── AppService.java
│ │ ├── ApplyService.java
│ │ ├── AuditLogService.java
│ │ ├── EnvService.java
│ │ ├── LdapService.java
│ │ ├── OrgService.java
│ │ ├── QuotaService.java
│ │ ├── RoleService.java
│ │ ├── SpecTypeService.java
│ │ ├── UserExtService.java
│ │ ├── UserRoleService.java
│ │ ├── UserService.java
│ │ └── ZoneService.java
│ │ ├── utils
│ │ ├── ConvertUtils.java
│ │ ├── IPUtil.java
│ │ ├── JsonUtil.java
│ │ └── OkHttpClientUtil.java
│ │ └── vo
│ │ └── PageVO.java
└── resources
│ ├── application.properties
│ ├── atlas.sql
│ ├── dozer
│ └── dozer-mapping.xml
│ ├── logback-spring.xml
│ ├── static
│ ├── 2aab7b4fa0baa371669c7a9233ce34ab.jpg
│ ├── 6f0a76321d30f3c8120915e57f7bd77e.ttf
│ ├── index.html
│ ├── index.js
│ ├── index.js.map
│ ├── manifest.js
│ ├── manifest.js.map
│ ├── vendor.js
│ └── vendor.js.map
│ └── swagger
│ └── api.json
└── test
├── java
└── com
│ └── ppdai
│ └── atlas
│ ├── AtlasApplicationTests.java
│ ├── job
│ └── LdapUserJobTest.java
│ ├── manager
│ └── AppManageTest.java
│ ├── serialize
│ ├── CloudDto.java
│ ├── MyDateDeserializer.java
│ ├── MyDateSerializer.java
│ └── SerializeTest.java
│ └── service
│ ├── AppQuotaServiceTest.java
│ ├── AppServiceTest.java
│ ├── EnvServiceTest.java
│ ├── LdapServiceTest.java
│ ├── OrgServiceTest.java
│ ├── QuotaServiceTest.java
│ ├── RoleServiceTest.java
│ ├── SpecTypeServiceTest.java
│ ├── TestHelper.java
│ ├── UserExtServiceTest.java
│ ├── UserRoleServiceTest.java
│ └── UserServiceTest.java
└── resources
└── service
├── AppDto.json
├── AppDtoArray.json
├── EnvDto.json
├── EnvDtoArray.json
├── OrgDto.json
├── OrgDtoArray.json
├── QuotaDto.json
├── QuotaDtoArray.json
├── QuotaQueryDto.json
├── RoleDto.json
├── RoleDtoArray.json
├── SpecTypeDto.json
├── SpecTypeDtoArray.json
├── UserDto.json
└── UserDtoArray.json
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 |
12 | ### IntelliJ IDEA ###
13 | .idea
14 | *.iws
15 | *.iml
16 | *.ipr
17 |
18 | ### NetBeans ###
19 | nbproject/private/
20 | build/
21 | nbbuild/
22 | dist/
23 | nbdist/
24 | .nb-gradle/
25 |
26 | # front project
27 | */dist/
28 | */node_modules/
29 |
30 |
31 | #
32 | .mvn/
33 | mvnw
34 | mvnw.cmd
35 | atlas-client/
--------------------------------------------------------------------------------
/dependencies/authoritymanager-1.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FinVolution/atlas/332ed82cee0f90e67f4ce47189dd3717a1be91d8/dependencies/authoritymanager-1.1.jar
--------------------------------------------------------------------------------
/dependencies/authoritymanager-1.1.pom:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.ppdai.authority
7 | authoritymanager
8 | 1.1
9 | jar
10 |
11 | authoritymanager
12 | Demo project for Spring Boot
13 |
14 |
15 |
16 |
17 |
18 | org.springframework.boot
19 | spring-boot-starter-parent
20 | 1.5.2.RELEASE
21 | pom
22 | import
23 |
24 |
25 |
26 |
27 |
28 | UTF-8
29 | UTF-8
30 | 1.8
31 |
32 |
33 |
34 |
35 | ppdai-Releases
36 | Internal Releases
37 | http://maven.repo.ppdai.com/nexus/content/repositories/releases/
38 |
39 |
40 | ppdai-Snapshots
41 | Internal Snapshots
42 | http://maven.repo.ppdai.com/nexus/content/repositories/snapshots/
43 |
44 |
45 |
46 |
47 |
48 | org.springframework.boot
49 | spring-boot-starter-web
50 |
51 |
52 |
53 | org.projectlombok
54 | lombok
55 | true
56 |
57 |
58 | org.springframework.boot
59 | spring-boot-starter-test
60 | test
61 |
62 |
63 | org.aspectj
64 | aspectjweaver
65 | 1.8.6
66 |
67 |
68 |
69 | org.aspectj
70 | aspectjrt
71 | 1.8.11
72 |
73 |
74 |
75 | com.ppdai.auth
76 | pauth-spring-support
77 | 1.1.2
78 |
79 |
80 |
81 |
82 | com.auth0
83 | java-jwt
84 | 3.1.0
85 |
86 |
87 |
88 |
89 |
90 |
91 |
--------------------------------------------------------------------------------
/front/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": ["vue-app"]
3 | }
4 |
--------------------------------------------------------------------------------
/front/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "element-starter",
3 | "description": "A Vue.js project",
4 | "author": "yi.shyang@ele.me",
5 | "private": true,
6 | "scripts": {
7 | "dev": "webpack-dev-server --inline --hot --env.dev",
8 | "build": "rimraf dist && webpack -p --progress --hide-modules"
9 | },
10 | "dependencies": {
11 | "axios": "^0.16.2",
12 | "element-ui": "^2.1.0",
13 | "jwt-decode": "^2.1.0",
14 | "qs": "latest",
15 | "vue": "^2.5.2",
16 | "vue-json-pretty": "^1.6.3",
17 | "vue-router": "^2.8.1",
18 | "vuex": "^2.5.0"
19 | },
20 | "engines": {
21 | "node": ">=6"
22 | },
23 | "devDependencies": {
24 | "autoprefixer": "^6.6.0",
25 | "babel-core": "^6.24.1",
26 | "babel-loader": "^6.4.0",
27 | "babel-plugin-component": "^0.9.1",
28 | "babel-preset-vue-app": "^1.3.2",
29 | "copy-webpack-plugin": "^4.5.1",
30 | "cross-env": "^1.0.6",
31 | "css-loader": "^0.27.0",
32 | "file-loader": "^0.10.1",
33 | "html-webpack-plugin": "^2.24.1",
34 | "jsonwebtoken": "^7.3.0",
35 | "postcss-loader": "^1.3.3",
36 | "request": "^2.83.0",
37 | "rimraf": "^2.6.2",
38 | "style-loader": "^0.13.2",
39 | "uglifyjs-webpack-plugin": "^0.4.6",
40 | "url-loader": "^0.5.8",
41 | "vue-loader": "^13.7.1",
42 | "vue-template-compiler": "^2.5.2",
43 | "webpack": "^2.4.5",
44 | "webpack-dev-server": "^2.11.1"
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/front/postcss.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | plugins: [
3 | require('autoprefixer')()
4 | ]
5 | }
6 |
--------------------------------------------------------------------------------
/front/src/api/index.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 | import service from './service'
3 |
4 | axios.defaults.timeout = 50000;
5 | axios.defaults.headers.common['Authorization'] = "31313113";
6 | axios.defaults.headers.post['Content-Type'] = 'application/json';
7 | axios.defaults.headers.put['Content-Type'] = 'application/json';
8 |
9 | export const api = service;
10 |
11 |
--------------------------------------------------------------------------------
/front/src/api/restApi.js:
--------------------------------------------------------------------------------
1 | import axios from 'axios'
2 |
3 | export default {
4 |
5 | doGetRequest(url){
6 | return axios.get(url)
7 | .then((response) => Promise.resolve(response))
8 | .catch((error) => Promise.reject(error))
9 | },
10 | doDeleteRequest(url){
11 | return axios.delete(url)
12 | .then((response) => Promise.resolve(response))
13 | .catch((error) => Promise.reject(error))
14 | },
15 | doPutRequest(url, data){
16 | if (typeof(data) == "object") {
17 | data = JSON.stringify(data);
18 | }
19 |
20 | return axios.put(url, data)
21 | .then((response) => Promise.resolve(response))
22 | .catch((error) => Promise.reject(error))
23 | },
24 | doPostRequest(url, data){
25 | if (typeof(data) == "object") {
26 | data = JSON.stringify(data);
27 | }
28 |
29 | return axios.post(url, data)
30 | .then((response) => Promise.resolve(response))
31 | .catch((error) => Promise.reject(error))
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/front/src/api/service/appQuotaService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 | import {handResponse} from "~/common/common";
3 |
4 | export default {
5 | deleteAppQuota(request = {}){
6 | let url = "/web/appquotas/" + request.appQuotaId;
7 | return restApi.doDeleteRequest(url);
8 | },
9 | createAppQuota(request = {}) {
10 | let url = "/web/appquotas";
11 | return restApi.doPostRequest(url, request.newAppQuota);
12 | },
13 |
14 | getAllAppQuotas(request = {}) {
15 | let url = '/web/appquotas/page?page=' + (request.page - 1) + '&size=' + request.pageSize;
16 | return restApi.doGetRequest(url);
17 | },
18 |
19 | searchAppQuotas(request = {}) {
20 | let url = '/web/appquotas/condition?page=' + (request.page - 1) + '&size=' + request.pageSize + '&appId=' + request.appQuotaQuery.appId;
21 |
22 | if(request.appQuotaQuery.envId != null)
23 | url =url + '&envId=' + request.appQuotaQuery.envId;
24 |
25 | return restApi.doGetRequest(url);
26 | },
27 |
28 | updateAppQuota(request = {}) {
29 | let url = "/web/appquotas";
30 | return restApi.doPutRequest(url, request.newAppQuota)
31 | },
32 |
33 | initAllQuotas(request = {}) {
34 | let url = '/web/appquotas/init';
35 | return restApi.doPostRequest(url);
36 | },
37 |
38 | initAppQuotas(request = {}) {
39 | let url = '/web/appquotas/init?appId=' + request.appId;
40 | return restApi.doPostRequest(url);
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/front/src/api/service/appService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 | import {handResponse} from "~/common/common";
3 |
4 | export default {
5 | //get all by page
6 | getAllApps(request = {}) {
7 | let url = '/web/apps/page/plus?page=' + (request.page - 1) + '&size=' + request.pageSize;
8 | return restApi.doGetRequest(url);
9 | },
10 | deleteApp(request = {}) {
11 | let url = "/web/apps/" + request.appId;
12 | return restApi.doDeleteRequest(url);
13 | },
14 | createApp(request = {}) {
15 | let url = "/web/apps";
16 | return restApi.doPostRequest(url, request.newApp);
17 | },
18 |
19 | fuzzySearchAppByAppName(request = {}) {
20 | let url = '/web/apps/fuzzy/appname?appName=' + request.appName;
21 | return restApi.doGetRequest(url);
22 | },
23 |
24 | queryAppsByAppName(request = {}) {
25 | let url = '/web/apps/appname?appName=' + request.appName;
26 | return restApi.doGetRequest(url);
27 | },
28 |
29 | searchApps(request = {}) {
30 | let url = '/web/apps/condition/plus?page=' + (request.page - 1) + '&size=' + request.pageSize;
31 |
32 | //判断查询参数是否为空
33 | if (request.queryApp.appId != null) {
34 | url = url + '&appId=' + request.queryApp.appId;
35 | }
36 |
37 | url = url + '&userWorkNumber=' + request.queryApp.userWorkNumber;
38 | url = url + '&appName=' + request.queryApp.appName;
39 |
40 | if (request.queryApp.orgId != null) {
41 | url = url + '&orgId=' + request.queryApp.orgId;
42 | }
43 |
44 | return restApi.doGetRequest(url);
45 | },
46 |
47 | updateApp(request = {}) {
48 | let url = "/web/apps";
49 | return restApi.doPutRequest(url, request.newApp)
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/front/src/api/service/applyService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 |
3 | export default {
4 |
5 | queryByPage(request = {}) {
6 | let url = '/web/apply/queryByPage?applyUser=' + request.applyUser
7 | + '&status=' + request.status
8 | + '&page=' + request.page
9 | + '&size=' + request.size;
10 | return restApi.doGetRequest(url);
11 | },
12 |
13 | queryById(request = {}) {
14 | let url = '/admin/users';
15 | return restApi.doGetRequest(url);
16 | },
17 |
18 | updateStatus(request = {}) {
19 | let url = '/web/apply/updateStatus';
20 | return restApi.doPostRequest(url, request);
21 | }
22 |
23 | }
--------------------------------------------------------------------------------
/front/src/api/service/authService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 |
3 | export default {
4 | fetchToken(request = {}) {
5 | let url = '/api/token/fetch?code=' + request.code;
6 | return restApi.doGetRequest(url);
7 | },
8 | refreshToken(request = {}) {
9 | let url = '/api/token/refresh?refresh_token=' + request.refresh_token;
10 | return restApi.doGetRequest(url);
11 | },
12 | revokeToken(request = {}) {
13 | let url = '/api/token/revoke?token=' + request.token;
14 | return restApi.doGetRequest(url);
15 | },
16 |
17 | fetchLoginUrl(request = {}) {
18 | let url = null;
19 | if (request != null && request.redirect_url != null) {
20 | url = 'api/login/url?redirect_url=' + encodeURIComponent(request.redirect_url);
21 | } else {
22 | url = 'api/login/url';
23 | }
24 | return restApi.doGetRequest(url);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/front/src/api/service/cloudService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 | import {handResponse} from "~/common/common";
3 |
4 | export default {
5 | getCloudById(cloudId) {
6 | let url = '/web/sites/' + cloudId;
7 | return restApi.doGetRequest(url);
8 | },
9 | //get all by page
10 | getAllClouds(request = {}) {
11 | let url = '/web/clouds/page?page=' + (request.page - 1) + '&size=' + request.pageSize;
12 | return restApi.doGetRequest(url);
13 | },
14 | deleteCloud(request = {}){
15 | let url = "/web/clouds/" + request.cloudId;
16 | return restApi.doDeleteRequest(url);
17 | },
18 | createCloud(request = {}) {
19 | let url = "/web/clouds";
20 | return restApi.doPostRequest(url, request.newCloud);
21 | },
22 | searchClouds(request = {}) {
23 | let url = '/web/clouds/condition?page=' + (request.page - 1) + '&size=' + request.pageSize;
24 | url = url + '&cloudName=' + request.cloudName;
25 | return restApi.doGetRequest(url);
26 | },
27 |
28 | updateCloud(request = {}) {
29 | let url = "/web/clouds";
30 | return restApi.doPutRequest(url, request.newCloud)
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/front/src/api/service/envService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 | import {handResponse} from "~/common/common";
3 |
4 | export default {
5 | getEnvById(envId) {
6 | let url = '/web/envs/' + envId;
7 | return restApi.doGetRequest(url);
8 | },
9 | //get all by page
10 | getAllEnvs(request = {}) {
11 | let url = '/web/envs/page?page=' + (request.page - 1) + '&size=' + request.pageSize;
12 | return restApi.doGetRequest(url);
13 | },
14 | deleteEnv(request = {}) {
15 | let url = "/web/envs/" + request.envId;
16 | return restApi.doDeleteRequest(url);
17 | },
18 | createEnv(request = {}) {
19 | let url = "/web/envs";
20 | return restApi.doPostRequest(url, request.newEnv);
21 | },
22 | searchEnvs(request = {}) {
23 | let url = '/web/envs/condition?page=' + (request.page - 1) + '&size=' + request.pageSize ;
24 | if(request.queryEnv.registryCenterId != null)
25 | url = url + '®istryCenterId=' + request.queryEnv.registryCenterId;
26 |
27 | if(request.queryEnv.cloudId != null)
28 | url = url + '&cloudId=' + request.queryEnv.cloudId;
29 |
30 |
31 | return restApi.doGetRequest(url);
32 | },
33 |
34 | updateEnv(request = {}) {
35 | let url = "/web/envs";
36 | return restApi.doPutRequest(url, request.newEnv)
37 | }
38 |
39 | }
40 |
--------------------------------------------------------------------------------
/front/src/api/service/index.js:
--------------------------------------------------------------------------------
1 | import authService from './authService'
2 | import cloudService from './cloudService'
3 | import zoneService from './zoneService'
4 | import appService from './appService'
5 | import envService from './envService'
6 | import orgService from './orgService'
7 | import roleService from './roleService'
8 | import userService from './userService'
9 | import quotaService from './quotaService'
10 | import appQuotaService from './appQuotaService'
11 | import specTypeService from './specTypeService'
12 | import applyService from "./applyService";
13 |
14 |
15 | export default {
16 | authService,
17 | cloudService,
18 | zoneService,
19 | appService,
20 | envService,
21 | userService,
22 | orgService,
23 | quotaService,
24 | appQuotaService,
25 | roleService,
26 | specTypeService,
27 | applyService,
28 | //userExtService
29 | };
30 |
--------------------------------------------------------------------------------
/front/src/api/service/orgService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 | import {handResponse} from "~/common/common";
3 |
4 | export default {
5 | getOrgById(orgId) {
6 | let url = '/web/orgs/' + orgId;
7 | return restApi.doGetRequest(url);
8 | },
9 | //get all by page
10 | getAllOrgs(request = {}) {
11 | let url = '/web/orgs/page?page=' + (request.page - 1) + '&size=' + request.pageSize;
12 | return restApi.doGetRequest(url);
13 | },
14 | deleteOrg(request = {}) {
15 | let url = "/web/orgs/" + request.orgId;
16 | return restApi.doDeleteRequest(url);
17 | },
18 | createOrg(request = {}) {
19 | let url = "/web/orgs";
20 | return restApi.doPostRequest(url, request.newOrg);
21 | },
22 | searchOrgs(request = {}) {
23 | let url = '/web/orgs/condition?page=' + (request.page - 1) + '&size=' + request.pageSize + '&name=' + request.queryOrg.name;
24 |
25 | if (request.queryOrg.userId != null) {
26 | url = url + "&userWorkNumber=" + request.queryOrg.userWorkNumber;
27 | }
28 |
29 | return restApi.doGetRequest(url);
30 | },
31 |
32 | updateOrg(request = {}) {
33 | let url = "/web/orgs";
34 | return restApi.doPutRequest(url, request.newOrg)
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/front/src/api/service/quotaService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 | import {handResponse} from "~/common/common";
3 |
4 | export default {
5 | getQuotaById(quotaId) {
6 | let url = '/web/quotas/' + quotaId;
7 | return restApi.doGetRequest(url);
8 | },
9 |
10 | deleteQuota(request = {}){
11 | let url = "/web/quotas/" + request.quotaId;
12 | return restApi.doDeleteRequest(url);
13 | },
14 | createQuota(request = {}) {
15 | let url = "/web/quotas";
16 | return restApi.doPostRequest(url, request.newQuota);
17 | },
18 |
19 | //get all by page
20 | getAllQuotas(request = {}) {
21 | let url = '/web/quotas/page?page=' + (request.page - 1) + '&size=' + request.pageSize;
22 | return restApi.doGetRequest(url);
23 | },
24 |
25 | //get all quota when quotaQuery is null
26 | searchQuotas(request = {}) {
27 | let url = '/web/quotas/condition?page=' + (request.page - 1) + '&size=' + request.pageSize + '&orgName=' + request.quotaQuery.orgName;
28 |
29 | if(request.quotaQuery.envId != null)
30 | url =url + '&envId=' + request.quotaQuery.envId;
31 |
32 | return restApi.doGetRequest(url);
33 | },
34 |
35 | updateQuota(request = {}) {
36 | let url = "/web/quotas";
37 | return restApi.doPutRequest(url, request.newQuota)
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/front/src/api/service/roleService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 | import {handResponse} from "~/common/common";
3 |
4 | export default {
5 | getRoleById(roleId) {
6 | let url = '/web/roles/' + roleId;
7 | return restApi.doGetRequest(url);
8 | },
9 | getAllRoles(request = {}) {
10 | let url = '/web/roles/all';
11 | return restApi.doGetRequest(url);
12 | },
13 | //get all by page
14 | getAllRolesByPage(request = {}) {
15 | let url = '/web/roles/page?page=' + (request.page - 1) + '&size=' + request.pageSize;
16 | return restApi.doGetRequest(url);
17 | },
18 | deleteRole(request = {}){
19 | let url = "/web/roles/" + request.roleId;
20 | return restApi.doDeleteRequest(url);
21 | },
22 | createRole(request = {}) {
23 | let url = "/web/roles";
24 | return restApi.doPostRequest(url, request.newRole);
25 | },
26 | searchRoles(request = {}) {
27 | let url = '/web/roles/condition?page=' + (request.page - 1) + '&size=' + request.pageSize + '&name=' + request.queryRole.name;
28 |
29 | return restApi.doGetRequest(url);
30 | },
31 |
32 | updateRole(request = {}) {
33 | //debugger
34 | let url = "/web/roles";
35 | return restApi.doPutRequest(url, request.newRole)
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/front/src/api/service/specTypeService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 | import {handResponse} from "~/common/common";
3 |
4 | export default {
5 | getSpecTypeById(specTypeId) {
6 | let url = '/web/specTypes/' + specTypeId;
7 | return restApi.doGetRequest(url);
8 | },
9 | //get all by page
10 | getAllSpecTypes(request = {}) {
11 | let url = '/web/specTypes/page?page=' + (request.page - 1) + '&size=' + request.pageSize;
12 | return restApi.doGetRequest(url);
13 | },
14 | deleteSpecType(request = {}){
15 | let url = "/web/specTypes/" + request.specTypeId;
16 | return restApi.doDeleteRequest(url);
17 | },
18 | createSpecType(request = {}) {
19 | let url = "/web/specTypes";
20 | return restApi.doPostRequest(url, request.newSpecType);
21 | },
22 | searchSpecTypes(request = {}) {
23 | let url = '/web/specTypes/condition?page=' + (request.page - 1) + '&size=' + request.pageSize + '&name=' + request.specTypeQuery.name;
24 |
25 | if(request.specTypeQuery.cpu != null)
26 | url = url + '&cpu='+ request.specTypeQuery.cpu;
27 | if(request.specTypeQuery.memory != null)
28 | url = url +'&memory=' + request.specTypeQuery.memory;
29 | if(request.specTypeQuery.disk != null)
30 | url = url + '&disk=' + request.specTypeQuery.disk;
31 |
32 | return restApi.doGetRequest(url);
33 | },
34 |
35 | updateSpecType(request = {}) {
36 | let url = "/web/specTypes";
37 | return restApi.doPutRequest(url, request.newSpecType)
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/front/src/api/service/userService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 | import {handResponse} from "~/common/common";
3 |
4 | export default {
5 | getUserById(userId) {
6 | let url = '/web/users/' + userId;
7 | return restApi.doGetRequest(url);
8 | },
9 | //get all by page
10 | getAllUsers(request = {}) {
11 | let url = '/web/users/page?page=' + (request.page - 1) + '&size=' + request.pageSize;
12 | return restApi.doGetRequest(url);
13 | },
14 | deleteUser(request = {}) {
15 | let url = "/web/users/" + request.userId;
16 | return restApi.doDeleteRequest(url);
17 | },
18 | createUser(request = {}) {
19 | let url = "/web/users";
20 | return restApi.doPostRequest(url, request.newUser);
21 | },
22 |
23 | searchUsers(request = {}) {
24 | let url = '/web/users/condition?page=' + (request.page - 1) + '&size=' + request.pageSize + '&realName=' + request.queryUser.realName + '&userName=' + request.queryUser.userName;
25 | //if(request.queryUser.orgId != null)
26 | url = url + '&orgCode=' + request.queryUser.orgCode;
27 |
28 | return restApi.doGetRequest(url);
29 | },
30 |
31 | //模糊查询
32 | fuzzySearchUsersByName(request = {}) {
33 | let url = '/web/users/fuzzy/username/?userName=' + request.userName;
34 | return restApi.doGetRequest(url);
35 | },
36 |
37 | updateUser(request = {}) {
38 | let url = "/web/users";
39 | return restApi.doPutRequest(url, request.newUser)
40 | },
41 |
42 | //get roles by userId
43 | getRolesByUserId(request = {}) {
44 | let url = "/web/userroles/roles/" + request.userId;
45 | return restApi.doGetRequest(url)
46 | },
47 |
48 | //add UserRole
49 | addUserRole(request = {}) {
50 | let url = '/web/userroles/' + request.userWorkNumber;
51 | return restApi.doPostRequest(url, request.roleIds);
52 | },
53 |
54 | //add user org
55 | addUserOrg(request = {}) {
56 | let url = '/web/userexts/';
57 | return restApi.doPostRequest(url, request.newUserExt);
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/front/src/api/service/zoneService.js:
--------------------------------------------------------------------------------
1 | import restApi from '../restApi'
2 | import {handResponse} from "~/common/common";
3 |
4 | export default {
5 | getZoneById(cloudId) {
6 | let url = '/web/zones/' + cloudId;
7 | return restApi.doGetRequest(url);
8 | },
9 | //get all by page
10 | getAllZones(request = {}) {
11 | let url = '/web/zones/page?page=' + (request.page - 1) + '&size=' + request.pageSize;
12 | return restApi.doGetRequest(url);
13 | },
14 | deleteZone(request = {}){
15 | let url = "/web/zones/" + request.zoneId;
16 | return restApi.doDeleteRequest(url);
17 | },
18 | createZone(request = {}) {
19 | let url = "/web/zones";
20 | return restApi.doPostRequest(url, request.newZone);
21 | },
22 | searchZones(request = {}) {
23 | let url = '/web/zones/condition?page=' + (request.page - 1) + '&size=' + request.pageSize;
24 | url = url + '&envName=' + request.envName + '&zoneName=' + request.zoneName;
25 | return restApi.doGetRequest(url);
26 | },
27 |
28 | updateZone(request = {}) {
29 | let url = "/web/zones";
30 | return restApi.doPutRequest(url, request.newZone)
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/front/src/assets/css/color-dark.css:
--------------------------------------------------------------------------------
1 | .header{
2 | background-color: #409EFF;
3 | }
4 | .login-wrap{
5 | background: #16673b;
6 | }
7 | .plugins-tips{
8 | background: #eef1f6;
9 | }
10 | .plugins-tips a{
11 | color: #20a0ff;
12 | }
13 | .el-upload--text em {
14 | color: #20a0ff;
15 | }
16 | .pure-button{
17 | background: #20a0ff;
18 | }
19 | .vue-datasource .btn-primary {
20 | color: #fff;
21 | background-color: #20a0ff !important;
22 | border-color: #20a0ff !important;
23 | }
24 | .pagination > .active > a, .pagination > .active > a:hover, .pagination > .active > a:focus, .pagination > .active > span, .pagination > .active > span:hover, .pagination > .active > span:focus {
25 | background-color: #20a0ff !important;
26 | border-color: #20a0ff !important;
27 | }
--------------------------------------------------------------------------------
/front/src/assets/css/theme-green/color-green.css:
--------------------------------------------------------------------------------
1 | .header{
2 | background-color: #00d1b2;
3 | }
4 | .login-wrap{
5 | background: rgba(56, 157, 170, 0.82);;
6 | }
7 | .plugins-tips{
8 | background: #f2f2f2;
9 | }
10 | .plugins-tips a{
11 | color: #00d1b2;
12 | }
13 | .el-upload--text em {
14 | color: #00d1b2;
15 | }
16 | .pure-button{
17 | background: #00d1b2;
18 | }
19 | .vue-datasource .btn-primary {
20 | color: #fff;
21 | background-color: #00d1b2 !important;
22 | border-color: #00d1b2 !important;
23 | }
24 | .pagination > .active > a, .pagination > .active > a:hover, .pagination > .active > a:focus, .pagination > .active > span, .pagination > .active > span:hover, .pagination > .active > span:focus {
25 | background-color: #00d1b2 !important;
26 | border-color: #00d1b2 !important;
27 | }
--------------------------------------------------------------------------------
/front/src/assets/css/theme-green/fonts/element-icons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FinVolution/atlas/332ed82cee0f90e67f4ce47189dd3717a1be91d8/front/src/assets/css/theme-green/fonts/element-icons.ttf
--------------------------------------------------------------------------------
/front/src/assets/css/theme-green/fonts/element-icons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FinVolution/atlas/332ed82cee0f90e67f4ce47189dd3717a1be91d8/front/src/assets/css/theme-green/fonts/element-icons.woff
--------------------------------------------------------------------------------
/front/src/assets/img/dog.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FinVolution/atlas/332ed82cee0f90e67f4ce47189dd3717a1be91d8/front/src/assets/img/dog.jpg
--------------------------------------------------------------------------------
/front/src/common/common.js:
--------------------------------------------------------------------------------
1 | function handResponse(res) {
2 | if (res.data.code !== 0) {
3 | let errMessage = "error code:" + res.data.code + ", error message :" + res.data.message;
4 | return Promise.reject({
5 | code: res.data.code,
6 | message: errMessage
7 | });
8 | } else {
9 | return Promise.resolve(res);
10 | }
11 | }
12 |
13 | export {handResponse};
--------------------------------------------------------------------------------
/front/src/common/commonPlugin.js:
--------------------------------------------------------------------------------
1 | let commonPlugin = {};
2 |
3 | commonPlugin.install = function (Vue) {
4 | Vue.prototype.$success = function (msg) {
5 | Vue.prototype.$message({
6 | showClose: true,
7 | message: msg,
8 | type: 'success'
9 | });
10 | };
11 | Vue.prototype.$fail = function (msg) {
12 | Vue.prototype.$message({
13 | showClose: true,
14 | message: msg,
15 | type: 'error',
16 | duration:10000
17 | });
18 | };
19 | };
20 |
21 | export default commonPlugin;
--------------------------------------------------------------------------------
/front/src/components/Introduction.vue:
--------------------------------------------------------------------------------
1 |
2 | 首页
3 |
4 |
5 |
9 |
--------------------------------------------------------------------------------
/front/src/components/Login.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 正在登陆中,请稍后...
5 |
6 |
7 |
8 |
当前登录失败,请回到首页重新尝试登录。
9 |
回到首页
10 |
11 |
12 |
13 |
14 |
79 |
80 |
--------------------------------------------------------------------------------
/front/src/components/layout/Home.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
39 |
--------------------------------------------------------------------------------
/front/src/components/layout/SideBar.vue:
--------------------------------------------------------------------------------
1 |
2 |
36 |
37 |
40 |
59 |
--------------------------------------------------------------------------------
/front/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Hello, ATLAS
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/front/src/main.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue';
2 |
3 | import router from './router';
4 | import ElementUI from 'element-ui';
5 | import 'element-ui/lib/theme-chalk/index.css';
6 | import commonPlugin from '~/common/commonPlugin';
7 | // import './assets/css/theme-green/index.css';
8 | // import './assets/css/theme-green/color-green.css';
9 | import './assets/css/color-dark.css';
10 | import './assets/css/main.css';
11 | import store from './store'
12 | import axios from 'axios'
13 | import jwtTokenUtil from "./utils/jwtTokenUtil";
14 |
15 | Vue.prototype.$http = axios;
16 |
17 | Vue.use(ElementUI);
18 | Vue.use(commonPlugin);
19 |
20 | // http request 拦截器
21 | axios.interceptors.request.use(
22 | config => {
23 | let jwtToken = jwtTokenUtil.readAccess();
24 | // 给http请求的header加上jwt-token
25 | config.headers['jwt-token'] = jwtToken;
26 | return config;
27 | },
28 | error => {
29 | return Promise.reject(error);
30 | }
31 | );
32 |
33 | new Vue({
34 | store,
35 | router,
36 | }).$mount('#app');
37 |
38 |
--------------------------------------------------------------------------------
/front/src/router/index.js:
--------------------------------------------------------------------------------
1 |
2 | import Vue from 'vue';
3 | import Router from 'vue-router';
4 | import Login from '../components/Login.vue'
5 | import Home from '../components/layout/Home.vue'
6 | import Introduction from '../components/Introduction.vue'
7 | import ZoneList from '../components/ZoneList.vue'
8 | import AppList from '../components/AppList.vue'
9 | import EnvList from '../components/EnvList.vue'
10 | import OrgList from '../components/OrgList.vue'
11 | import RoleList from '../components/RoleList.vue'
12 | import UserList from '../components/UserList.vue'
13 | import QuotaList from '../components/QuotaList.vue'
14 | import AppQuotaList from '../components/AppQuotaList.vue'
15 |
16 | import SpecTypeList from '../components/SpecTypeList.vue'
17 | import ApplyList from '../components/ApplyList.vue'
18 |
19 | Vue.use(Router);
20 |
21 | export default new Router({
22 | mode: "hash",
23 | routes: [
24 | {
25 | path: '/',
26 | component: Home,
27 | children: [
28 | {
29 | path: '',
30 | name: 'Introduction',
31 | component: Introduction
32 | },
33 | {
34 | path: '/apps',
35 | name: 'AppList',
36 | component: AppList
37 | },
38 | {
39 | path: '/zones',
40 | name: 'ZoneList',
41 | component: ZoneList
42 | },
43 | {
44 | path: '/orgs',
45 | name: 'OrgList',
46 | component: OrgList
47 | },
48 | {
49 | path: '/envs',
50 | name: 'EnvList',
51 | component: EnvList
52 | },
53 | {
54 | path: '/roles',
55 | name: 'RoleList',
56 | component: RoleList
57 | },
58 | {
59 | path: '/specTypes',
60 | name: 'SpecTypeList',
61 | component: SpecTypeList
62 | },
63 | {
64 | path: '/quotas',
65 | name: 'QuotaList',
66 | component: QuotaList
67 | },
68 | {
69 | path: '/appquotas',
70 | name: 'AppQuotaList',
71 | component: AppQuotaList
72 | },
73 | {
74 | path: '/users',
75 | name: 'UserList',
76 | component: UserList
77 | },
78 | {
79 | path: '/applies',
80 | name: 'ApplyList',
81 | component: ApplyList
82 | }
83 | ]
84 | },
85 | {
86 | path: '/login',
87 | name: 'Login',
88 | component: Login,
89 | }
90 | ],
91 | linkActiveClass: 'active'
92 | })
93 |
--------------------------------------------------------------------------------
/front/src/store/index.js:
--------------------------------------------------------------------------------
1 |
2 | import Vue from 'vue'
3 | import Vuex from 'vuex'
4 | import cloudList from './modules/cloudStore'
5 | import zoneList from './modules/zoneStore'
6 | import appList from './modules/appStore'
7 | import envList from './modules/envStore'
8 | import orgList from './modules/orgStore'
9 | import roleList from './modules/roleStore'
10 | import quotaList from './modules/quotaStore'
11 | import appQuotaList from './modules/appQuotaStore'
12 |
13 | import userList from './modules/userStore'
14 | import specTypeList from './modules/specTypeStore'
15 | import pauth from './modules/pauth'
16 | import apply from './modules/apply'
17 |
18 | Vue.use(Vuex);
19 |
20 | const debug = process.env.NODE_ENV !== 'production';
21 |
22 | export default new Vuex.Store({
23 | modules: {
24 | cloudList,
25 | zoneList,
26 | appList,
27 | envList,
28 | orgList,
29 | userList,
30 | roleList,
31 | quotaList,
32 | appQuotaList,
33 | specTypeList,
34 | apply,
35 | pauth
36 | },
37 | strict: debug
38 | })
39 |
40 |
--------------------------------------------------------------------------------
/front/src/store/modules/cloudStore.js:
--------------------------------------------------------------------------------
1 | import * as types from '../mutation-types'
2 | import {api} from '../../api'
3 | import Vue from 'vue'
4 |
5 |
6 | // initial state
7 | const state = {
8 | clouds: [],
9 | totalClouds: null
10 | };
11 |
12 | // getters
13 | const getters = {
14 | getAllClouds: state => state.clouds,
15 | getTotalClouds: state => state.totalClouds
16 | };
17 |
18 | // actions
19 | const actions = {
20 |
21 | fetchAllClouds({commit}, data) {
22 | api.cloudService.getAllClouds(data).then(function (res) {
23 | commit("updateCloudsList", res.data.detail);
24 | }.bind(this)).catch(function (err) {
25 | console.log(err);
26 | }.bind(this));
27 | },
28 |
29 | deleteCloudById({dispatch}, data) {
30 | api.cloudService.deleteCloud(data).then(function (res) {
31 | if (res.data.code == 0) {
32 | dispatch("fetchAllClouds", data);
33 | }
34 | dispatch("displayPromptByResponseMsg", res);
35 | }.bind(this)).catch(function (err) {
36 | dispatch("displayPromptByResponseMsg", err.response);
37 | }.bind(this));
38 | },
39 |
40 |
41 | updateCloud({dispatch}, data) {
42 | api.cloudService.updateCloud(data).then(function (res) {
43 | if (res.data.code == 0) {
44 | dispatch("queryClouds", data);
45 | }
46 | dispatch("displayPromptByResponseMsg", res);
47 | }.bind(this)).catch(function (err) {
48 | dispatch("displayPromptByResponseMsg", err.response);
49 | }.bind(this));
50 | },
51 |
52 | createNewCloud({dispatch}, data) {
53 | api.cloudService.createCloud(data).then(function (res) {
54 | if (res.data.code == 0) {
55 | dispatch("fetchAllClouds", data);
56 | }
57 | dispatch("displayPromptByResponseMsg", res);
58 | }.bind(this)).catch(function (err) {
59 | dispatch("displayPromptByResponseMsg", err.response);
60 | }.bind(this));
61 | },
62 |
63 | queryClouds({commit}, data) {
64 | api.cloudService.searchClouds(data).then(function (res) {
65 | commit("updateCloudsList", res.data.detail);
66 | }.bind(this)).catch(function (err) {
67 | console.log(err);
68 | }.bind(this));
69 | },
70 |
71 | };
72 |
73 | // mutations
74 | const mutations = {
75 | updateCloudsList(state, data) {
76 | state.clouds = data.content;
77 | state.totalClouds = data.totalElements;
78 | }
79 | };
80 |
81 | export default {
82 | state,
83 | getters,
84 | actions,
85 | mutations
86 | }
--------------------------------------------------------------------------------
/front/src/store/modules/envStore.js:
--------------------------------------------------------------------------------
1 | import * as types from '../mutation-types'
2 | import {api} from '../../api'
3 | import Vue from 'vue'
4 |
5 |
6 | // initial state
7 | const state = {
8 | envs: [],
9 | totalEnvs: null
10 | };
11 |
12 | // getters
13 | const getters = {
14 | getAllEnvs: state => state.envs,
15 | getTotalEnvs: state => state.totalEnvs
16 | };
17 |
18 | // actions
19 | const actions = {
20 |
21 | fetchAllEnvs({commit}, data) {
22 | api.envService.getAllEnvs(data).then(function (res) {
23 | commit("updateEnvsList", res.data.detail);
24 | }.bind(this)).catch(function (err) {
25 | console.log(err);
26 | }.bind(this));
27 | },
28 |
29 | deleteEnvById({dispatch}, data) {
30 | api.envService.deleteEnv(data).then(function (res) {
31 | if (res.data.code == 0) {
32 | dispatch("fetchAllEnvs", data);
33 | }
34 | dispatch("displayPromptByResponseMsg", res);
35 | }.bind(this)).catch(function (err) {
36 | dispatch("displayPromptByResponseMsg", err.response);
37 | }.bind(this));
38 | },
39 |
40 |
41 | updateEnv({dispatch}, data) {
42 | api.envService.updateEnv(data).then(function (res) {
43 | if (res.data.code == 0) {
44 | dispatch("queryEnvs", data);
45 | }
46 | dispatch("displayPromptByResponseMsg", res);
47 | }.bind(this)).catch(function (err) {
48 | dispatch("displayPromptByResponseMsg", err.response);
49 | }.bind(this));
50 | },
51 |
52 | createNewEnv({dispatch}, data) {
53 | api.envService.createEnv(data).then(function (res) {
54 | if (res.data.code == 0) {
55 | dispatch("fetchAllEnvs", data);
56 | }
57 | dispatch("displayPromptByResponseMsg", res);
58 | }.bind(this)).catch(function (err) {
59 | dispatch("displayPromptByResponseMsg", err.response);
60 | }.bind(this));
61 | },
62 |
63 | queryEnvs({commit}, data) {
64 | api.envService.searchEnvs(data).then(function (res) {
65 | commit("updateEnvsList", res.data.detail);
66 |
67 | }.bind(this)).catch(function (err) {
68 | console.log(err);
69 | }.bind(this));
70 | },
71 |
72 | };
73 |
74 | // mutations
75 | const mutations = {
76 | updateEnvsList(state, data) {
77 | state.envs = data.content;
78 | state.totalEnvs = data.totalElements;
79 | }
80 | };
81 |
82 | export default {
83 | state,
84 | getters,
85 | actions,
86 | mutations
87 | }
--------------------------------------------------------------------------------
/front/src/store/modules/orgStore.js:
--------------------------------------------------------------------------------
1 | import * as types from '../mutation-types'
2 | import {api} from '../../api'
3 | import Vue from 'vue'
4 |
5 |
6 | // initial state
7 | const state = {
8 | orgs: [],
9 | totalOrgs: null
10 | };
11 |
12 | // getters
13 | const getters = {
14 | getAllOrgs: state => state.orgs,
15 | getTotalOrgs: state => state.totalOrgs
16 | };
17 |
18 | // actions
19 | const actions = {
20 |
21 | fetchAllOrgs({commit}, data) {
22 | api.orgService.getAllOrgs(data).then(function (res) {
23 | commit("updateOrgsList", res.data.detail);
24 | }.bind(this)).catch(function (err) {
25 | console.log(err);
26 | }.bind(this));
27 | },
28 |
29 | deleteOrgById({dispatch}, data) {
30 | api.orgService.deleteOrg(data).then(function (res) {
31 | if (res.data.code == 0) {
32 | dispatch("fetchAllOrgs", data);
33 | }
34 | dispatch("displayPromptByResponseMsg", res);
35 | }.bind(this)).catch(function (err) {
36 | dispatch("displayPromptByResponseMsg", err.response);
37 | }.bind(this));
38 | },
39 |
40 |
41 | updateOrg({dispatch}, data) {
42 | api.orgService.updateOrg(data).then(function (res) {
43 | if (res.data.code == 0) {
44 | dispatch("queryOrgs", data);
45 | }
46 | dispatch("displayPromptByResponseMsg", res);
47 | }.bind(this)).catch(function (err) {
48 | dispatch("displayPromptByResponseMsg", err.response);
49 | }.bind(this));
50 |
51 | },
52 |
53 | createNewOrg({dispatch}, data) {
54 | api.orgService.createOrg(data).then(function (res) {
55 | if (res.data.code == 0) {
56 | dispatch("fetchAllOrgs", data);
57 | }
58 | dispatch("displayPromptByResponseMsg", res);
59 | }.bind(this)).catch(function (err) {
60 | dispatch("displayPromptByResponseMsg", err.response);
61 | }.bind(this));
62 | },
63 |
64 | queryOrgs({commit}, data) {
65 | api.orgService.searchOrgs(data).then(function (res) {
66 | commit("updateOrgsList", res.data.detail);
67 | }.bind(this)).catch(function (err) {
68 | console.log(err);
69 | }.bind(this));
70 | },
71 |
72 | };
73 |
74 | // mutations
75 | const mutations = {
76 | updateOrgsList(state, data) {
77 | state.orgs = data.content;
78 | state.totalOrgs = data.totalElements;
79 | }
80 | };
81 |
82 | export default {
83 | state,
84 | getters,
85 | actions,
86 | mutations
87 | }
--------------------------------------------------------------------------------
/front/src/store/modules/quotaStore.js:
--------------------------------------------------------------------------------
1 | import * as types from '../mutation-types'
2 | import {api} from '../../api'
3 | import Vue from 'vue'
4 |
5 |
6 | // initial state
7 | const state = {
8 | quotas: [],
9 | totalQuotas: null
10 | };
11 |
12 | // getters
13 | const getters = {
14 | getAllQuotas: state => state.quotas,
15 | getTotalQuotas: state => state.totalQuotas
16 | };
17 |
18 | // actions
19 | const actions = {
20 |
21 | fetchAllQuotas({commit}, data) {
22 | api.quotaService.getAllQuotas(data).then(function (res) {
23 | commit("updateQuotasList", res.data.detail);
24 | }.bind(this)).catch(function (err) {
25 | console.log(err);
26 | }.bind(this));
27 | },
28 |
29 | queryQuotas({commit}, data) {
30 | api.quotaService.searchQuotas(data).then(function (res) {
31 | commit("updateQuotasList", res.data.detail);
32 | }.bind(this)).catch(function (err) {
33 | console.log(err);
34 | }.bind(this));
35 | },
36 |
37 | deleteQuotaById({dispatch}, data) {
38 | api.quotaService.deleteQuota(data).then(function (res) {
39 | if (res.data.code == 0) {
40 | dispatch("fetchAllQuotas", data);
41 | }
42 | dispatch("displayPromptByResponseMsg", res);
43 | }.bind(this)).catch(function (err) {
44 | dispatch("displayPromptByResponseMsg", err.response);
45 | }.bind(this));
46 | },
47 |
48 |
49 | updateQuota({dispatch}, data) {
50 | api.quotaService.updateQuota(data).then(function (res) {
51 | if (res.data.code == 0) {
52 | dispatch("queryQuotas", data);
53 | }
54 | dispatch("displayPromptByResponseMsg", res);
55 | }.bind(this)).catch(function (err) {
56 | dispatch("displayPromptByResponseMsg", err.response);
57 | }.bind(this));
58 |
59 | },
60 |
61 | createNewQuota({dispatch}, data) {
62 | api.quotaService.createQuota(data).then(function (res) {
63 | if (res.data.code == 0) {
64 | dispatch("fetchAllQuotas", data);
65 | }
66 | dispatch("displayPromptByResponseMsg", res);
67 | }.bind(this)).catch(function (err) {
68 | dispatch("displayPromptByResponseMsg", err.response);
69 | }.bind(this));
70 | },
71 |
72 | };
73 |
74 | // mutations
75 | const mutations = {
76 | updateQuotasList(state, data) {
77 | state.quotas = data.content;
78 | state.totalQuotas = data.totalElements;
79 | }
80 | };
81 |
82 | export default {
83 | state,
84 | getters,
85 | actions,
86 | mutations
87 | }
--------------------------------------------------------------------------------
/front/src/store/modules/roleStore.js:
--------------------------------------------------------------------------------
1 | import {api} from '../../api'
2 |
3 |
4 | // initial state
5 | const state = {
6 | roles: [],
7 | totalRoles: null
8 | };
9 |
10 | // getters
11 | const getters = {
12 | getAllRoles: state => state.roles,
13 | getRoleIds: state => state.roleIds,
14 | getTotalRoles: state => state.totalRoles
15 | };
16 |
17 | // actions
18 | const actions = {
19 |
20 | //get all roles
21 | fetchRoles({commit}) {
22 | api.roleService.getAllRoles().then(function (res) {
23 | commit("updateRolesList", res.data.detail);
24 | }.bind(this)).catch(function (err) {
25 | console.log(err);
26 | }.bind(this));
27 | },
28 |
29 | //get roles by page
30 | fetchAllRoles({commit}, data) {
31 | api.roleService.getAllRolesByPage(data).then(function (res) {
32 | commit("updateRolesList", res.data.detail);
33 | }.bind(this)).catch(function (err) {
34 | console.log(err);
35 | }.bind(this));
36 | },
37 |
38 | deleteRoleById({dispatch}, data) {
39 | api.roleService.deleteRole(data).then(function (res) {
40 | if (res.data.code == 0) {
41 | dispatch("fetchAllRoles", data);
42 | }
43 | dispatch("displayPromptByResponseMsg", res);
44 | }.bind(this)).catch(function (err) {
45 | dispatch("displayPromptByResponseMsg", err.response);
46 | }.bind(this));
47 | },
48 |
49 |
50 | updateRole({dispatch}, data) {
51 | api.roleService.updateRole(data).then(function (res) {
52 | if (res.data.code == 0) {
53 | dispatch("fetchAllRoles", data);
54 | }
55 | dispatch("displayPromptByResponseMsg", res);
56 | }.bind(this)).catch(function (err) {
57 | dispatch("displayPromptByResponseMsg", err.response);
58 | }.bind(this));
59 | },
60 |
61 | createNewRole({dispatch}, data) {
62 | api.roleService.createRole(data).then(function (res) {
63 | if (res.data.code == 0) {
64 | dispatch("fetchAllRoles", data);
65 | }
66 | dispatch("displayPromptByResponseMsg", res);
67 | }.bind(this)).catch(function (err) {
68 | dispatch("displayPromptByResponseMsg", err.response);
69 | }.bind(this));
70 | },
71 |
72 | queryRoles({commit}, data) {
73 | api.roleService.searchRoles(data).then(function (res) {
74 | debugger;
75 | commit("updateRolesList", res.data.detail);
76 | }.bind(this)).catch(function (err) {
77 | console.log(err);
78 | }.bind(this));
79 | },
80 |
81 | };
82 |
83 | // mutations
84 | const mutations = {
85 | updateRolesList(state, data) {
86 | state.roles = data.content;
87 | state.totalRoles = data.totalElements;
88 | }
89 | };
90 |
91 | export default {
92 | state,
93 | getters,
94 | actions,
95 | mutations
96 | }
--------------------------------------------------------------------------------
/front/src/store/modules/specTypeStore.js:
--------------------------------------------------------------------------------
1 | import * as types from '../mutation-types'
2 | import {api} from '../../api'
3 | import Vue from 'vue'
4 |
5 |
6 | // initial state
7 | const state = {
8 | specTypes: [],
9 | totalSpecTypes: null
10 | };
11 |
12 | // getters
13 | const getters = {
14 | getAllSpecTypes: state => state.specTypes,
15 | getTotalSpecTypes: state => state.totalSpecTypes
16 | };
17 |
18 | // actions
19 | const actions = {
20 |
21 | fetchAllSpecTypes({commit}, data) {
22 | api.specTypeService.getAllSpecTypes(data).then(function (res) {
23 | commit("updateSpecTypeList", res.data.detail);
24 | }.bind(this)).catch(function (err) {
25 | console.log(err);
26 | }.bind(this));
27 | },
28 |
29 | deleteSpecTypeById({dispatch}, data) {
30 | api.specTypeService.deleteSpecType(data).then(function (res) {
31 | if (res.data.code == 0) {
32 | dispatch("fetchAllSpecTypes", data);
33 | }
34 | dispatch("displayPromptByResponseMsg", res);
35 | }.bind(this)).catch(function (err) {
36 | dispatch("displayPromptByResponseMsg", err.response);
37 | }.bind(this));
38 | },
39 |
40 | updateSpecType({dispatch}, data) {
41 | api.specTypeService.updateSpecType(data).then(function (res) {
42 | if (res.data.code == 0) {
43 | dispatch("fetchAllSpecTypes", data);
44 | }
45 | dispatch("displayPromptByResponseMsg", res);
46 | }.bind(this)).catch(function (err) {
47 | dispatch("displayPromptByResponseMsg", err.response);
48 | }.bind(this));
49 | },
50 |
51 | createNewSpecType({dispatch}, data) {
52 | api.specTypeService.createSpecType(data).then(function (res) {
53 | if (res.data.code == 0) {
54 | dispatch("fetchAllSpecTypes", data);
55 | }
56 | dispatch("displayPromptByResponseMsg", res);
57 | }.bind(this)).catch(function (err) {
58 | dispatch("displayPromptByResponseMsg", err.response);
59 | }.bind(this));
60 | },
61 |
62 | querySpecTypes({commit}, data) {
63 | api.specTypeService.searchSpecTypes(data).then(function (res) {
64 | commit("updateSpecTypeList", res.data.detail);
65 | }.bind(this)).catch(function (err) {
66 | console.log(err);
67 | }.bind(this));
68 | },
69 |
70 | };
71 |
72 | // mutations
73 | const mutations = {
74 | updateSpecTypeList(state, data) {
75 | state.specTypes = data.content;
76 | state.totalSpecTypes = data.totalElements;
77 | }
78 | };
79 |
80 | export default {
81 | state,
82 | getters,
83 | actions,
84 | mutations
85 | }
--------------------------------------------------------------------------------
/front/src/store/modules/zoneStore.js:
--------------------------------------------------------------------------------
1 | import * as types from '../mutation-types'
2 | import {api} from '../../api'
3 | import Vue from 'vue'
4 |
5 |
6 | // initial state
7 | const state = {
8 | zones: [],
9 | totalZones: null
10 | };
11 |
12 | // getters
13 | const getters = {
14 | getAllZones: state => state.zones,
15 | getTotalZones: state => state.totalZones
16 | };
17 |
18 | // actions
19 | const actions = {
20 |
21 | fetchAllZones({commit}, data) {
22 | api.zoneService.getAllZones(data).then(function (res) {
23 | commit("updateZonesList", res.data.detail);
24 | }.bind(this)).catch(function (err) {
25 | console.log(err);
26 | }.bind(this));
27 | },
28 |
29 | deleteZoneById({dispatch}, data) {
30 | api.zoneService.deleteZone(data).then(function (res) {
31 | if (res.data.code == 0) {
32 | dispatch("fetchAllZones", data);
33 | }
34 | dispatch("displayPromptByResponseMsg", res);
35 | }.bind(this)).catch(function (err) {
36 | dispatch("displayPromptByResponseMsg", err.response);
37 | }.bind(this));
38 | },
39 |
40 |
41 | updateZone({dispatch}, data) {
42 | api.zoneService.updateZone(data).then(function (res) {
43 | if (res.data.code == 0) {
44 | dispatch("queryZones", data);
45 | }
46 | dispatch("displayPromptByResponseMsg", res);
47 | }.bind(this)).catch(function (err) {
48 | dispatch("displayPromptByResponseMsg", err.response);
49 | }.bind(this));
50 | },
51 |
52 | createNewZone({dispatch}, data) {
53 | api.zoneService.createZone(data).then(function (res) {
54 | if (res.data.code == 0) {
55 | dispatch("fetchAllZones", data);
56 | }
57 | dispatch("displayPromptByResponseMsg", res);
58 | }.bind(this)).catch(function (err) {
59 | dispatch("displayPromptByResponseMsg", err.response);
60 | }.bind(this));
61 | },
62 |
63 | queryZones({commit}, data) {
64 | api.zoneService.searchZones(data).then(function (res) {
65 | commit("updateZonesList", res.data.detail);
66 | }.bind(this)).catch(function (err) {
67 | console.log(err);
68 | }.bind(this));
69 | },
70 |
71 | };
72 |
73 | // mutations
74 | const mutations = {
75 | updateZonesList(state, data) {
76 | state.zones = data.content;
77 | state.totalZones = data.totalElements;
78 | }
79 | };
80 |
81 | export default {
82 | state,
83 | getters,
84 | actions,
85 | mutations
86 | }
--------------------------------------------------------------------------------
/front/src/store/mutation-types.js:
--------------------------------------------------------------------------------
1 | export const REFRESH_USER_INFO = 'REFRESH_USER_INFO';
2 | export const REFRESH_EXPIRE_INFO = 'REFRESH_EXPIRE_INFO';
3 | export const REFRESH_PROMPT_MESSAGE = 'REFRESH_PROMPT_MESSAGE';
4 | export const REFRESH_LOGIN_STATE = 'REFRESH_LOGIN_STATE';
5 | export const REFRESH_INVALID_LOGIN_STATE = 'REFRESH_INVALID_LOGIN_STATE';
6 | export const SAVE_LAST_VISIT = 'SAVE_LAST_VISIT';
7 | export const REFRESH_APPLY_LIST = 'REFRESH_APPLY_LIST';
8 |
9 |
--------------------------------------------------------------------------------
/front/src/utils/dateUtil.js:
--------------------------------------------------------------------------------
1 | const dateUtil = {
2 |
3 | formatDate(timestamp) {
4 | let sDate = "";
5 | if (timestamp != null) {
6 | let date = new Date(timestamp);
7 | sDate = date.toLocaleString();
8 | }
9 | return sDate;
10 | },
11 |
12 | formatDateEx(timestamp, fmt) {
13 | let date = new Date(timestamp);
14 |
15 | if (/(y+)/.test(fmt)) {
16 | fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
17 | }
18 |
19 | let o = {
20 | 'M+': date.getMonth() + 1,
21 | 'd+': date.getDate(),
22 | 'h+': date.getHours(),
23 | 'm+': date.getMinutes(),
24 | 's+': date.getSeconds()
25 | };
26 |
27 | for (let k in o) {
28 | if (new RegExp(`(${k})`).test(fmt)) {
29 | let str = o[k] + '';
30 |
31 | if (fmt.replace(RegExp.$1, (RegExp.$1.length === 1))) {
32 | fmt = str;
33 | } else {
34 | fmt = ('00' + str).substr(str.length);
35 | }
36 |
37 | // fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? str : this.padLeftZero(str));
38 | }
39 | }
40 |
41 | return fmt;
42 | },
43 |
44 | padLeftZero(str) {
45 | return ('00' + str).substr(str.length);
46 | }
47 |
48 | };
49 |
50 | export default dateUtil;
51 |
52 |
--------------------------------------------------------------------------------
/front/src/utils/encryptUtil.js:
--------------------------------------------------------------------------------
1 |
2 | export default {
3 |
4 | generateToken(data){
5 | let token = null;
6 | if (data != null) {
7 | data.timestamp = (new Date()).getTime();
8 | let c = window.btoa(JSON.stringify(data));
9 | token = c.split('').reverse().join('') + c.charAt(3) + c;
10 | }
11 | return token;
12 | }
13 |
14 | }
--------------------------------------------------------------------------------
/front/src/utils/jwtTokenUtil.js:
--------------------------------------------------------------------------------
1 |
2 | export default {
3 |
4 | saveAccess(token){
5 | localStorage.setItem("access-token", token);
6 | },
7 |
8 | readAccess(){
9 | return localStorage.getItem("access-token");
10 | },
11 |
12 | saveRefresh(token){
13 | localStorage.setItem("refresh-token", token);
14 | },
15 |
16 | readRefresh(){
17 | return localStorage.getItem("refresh-token");
18 | },
19 |
20 | clear(){
21 | localStorage.removeItem("access-token");
22 | localStorage.removeItem("refresh-token");
23 | },
24 |
25 | }
--------------------------------------------------------------------------------
/front/src/utils/lastVisitedUtil.js:
--------------------------------------------------------------------------------
1 |
2 | export default {
3 |
4 | save(url){
5 | localStorage.setItem("last-visited", url);
6 | },
7 |
8 | read(){
9 | return localStorage.getItem("last-visited");
10 | },
11 |
12 | clear(){
13 | localStorage.removeItem("last-visited");
14 | }
15 |
16 | }
--------------------------------------------------------------------------------
/front/src/vendor.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import ElementUI from 'element-ui'
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/AtlasApplication.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 |
7 |
8 | @SpringBootApplication
9 | @Slf4j
10 | public class AtlasApplication {
11 | public static void main(String[] args) throws InterruptedException {
12 | SpringApplication.run(AtlasApplication.class, args);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/aop/AuditLogAspect.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.aop;
2 |
3 |
4 | import com.ppdai.atlas.entity.AuditLogEntity;
5 | import com.ppdai.atlas.service.AuditLogService;
6 | import com.ppdai.auth.common.identity.Identity;
7 | import com.ppdai.auth.utils.PauthTokenUtil;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.aspectj.lang.JoinPoint;
10 | import org.aspectj.lang.annotation.Aspect;
11 | import org.aspectj.lang.annotation.Before;
12 | import org.aspectj.lang.reflect.MethodSignature;
13 | import org.springframework.beans.factory.annotation.Autowired;
14 | import org.springframework.core.annotation.Order;
15 | import org.springframework.stereotype.Component;
16 | import org.springframework.web.context.request.RequestContextHolder;
17 | import org.springframework.web.context.request.ServletRequestAttributes;
18 |
19 | import javax.servlet.http.HttpServletRequest;
20 | import java.lang.reflect.Method;
21 |
22 | @Aspect
23 | @Component
24 | @Slf4j
25 | @Order(4)
26 | public class AuditLogAspect {
27 | // 1
28 |
29 | @Autowired
30 | private AuditLogService auditLogService;
31 |
32 | @Autowired
33 | private PauthTokenUtil pauthTokenUtil;
34 |
35 | @Before("ResourcePointCuts.webController()")
36 | public void doSthBefore(JoinPoint joinPoint) {
37 |
38 | MethodSignature signature = (MethodSignature) joinPoint.getSignature();
39 | Method method = signature.getMethod();
40 |
41 | String methodName = method.getName();
42 | String returnType = method.getReturnType().getName();
43 |
44 | //可以获取请求request,进而获得对请求流程的控制
45 | ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
46 | HttpServletRequest request = attributes.getRequest();
47 | //获取请求URL
48 | String url = request.getRequestURL().toString();
49 | //获取请求方法 POST,PUT,GET,DELETE
50 | String httpMethod = request.getMethod();
51 |
52 | if ("GET".equalsIgnoreCase(httpMethod)) {
53 | return;
54 | }
55 |
56 | Object[] args = joinPoint.getArgs();
57 | StringBuilder paraStr = new StringBuilder();
58 | for (Object o : args) {
59 | if (o == null) {
60 | continue;
61 | }
62 | paraStr.append(o.getClass().getName()).append(": ").append(o).append(";");
63 | }
64 |
65 | String remoteAddr = request.getRemoteAddr();
66 |
67 | AuditLogEntity auditLogEntity = new AuditLogEntity();
68 | auditLogEntity.setHttpUri(url);
69 | auditLogEntity.setHttpMethod(httpMethod);
70 | auditLogEntity.setClientIp(remoteAddr);
71 | auditLogEntity.setClassMethodArgs(paraStr.toString());
72 | auditLogEntity.setClassMethod(methodName);
73 | auditLogEntity.setClassMethodReturn(returnType);
74 |
75 | Identity tokenInfo = pauthTokenUtil.getTokenInfo(request);
76 | String userName = tokenInfo.getName();
77 |
78 | auditLogEntity.setUserName(userName);
79 |
80 | auditLogService.addAuditLog(auditLogEntity);
81 |
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/aop/ExceptionAspect.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.aop;
2 |
3 | import com.ppdai.atlas.common.exception.AtlasServiceException;
4 | import com.ppdai.atlas.dto.Response;
5 | import lombok.extern.slf4j.Slf4j;
6 | import org.aspectj.lang.ProceedingJoinPoint;
7 | import org.aspectj.lang.annotation.Around;
8 | import org.aspectj.lang.annotation.Aspect;
9 | import org.springframework.core.annotation.Order;
10 | import org.springframework.stereotype.Component;
11 |
12 | /**
13 | * Global Exception handler
14 | */
15 | @Aspect
16 | @Component
17 | @Slf4j
18 | @Order(5)
19 | public class ExceptionAspect {
20 |
21 | @Around("com.ppdai.atlas.aop.ResourcePointCuts.webController()")
22 | public Object handleException(ProceedingJoinPoint apiMethod) {
23 |
24 |
25 | try {
26 | return apiMethod.proceed();
27 | } catch (AtlasServiceException e) {
28 | log.error(e.getMessage(), e);
29 | return Response.error(e);
30 | } catch (Throwable throwable) {
31 | log.error(throwable.getMessage(), throwable);
32 | return Response.error(throwable);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/aop/ResourcePointCuts.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.aop;
2 |
3 | import org.aspectj.lang.annotation.Pointcut;
4 |
5 | public class ResourcePointCuts {
6 |
7 | @Pointcut("execution(public * com.ppdai.atlas.controller..*.*(..))")
8 | public void webController() {
9 | }
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/common/exception/AtlasServiceException.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.common.exception;
2 |
3 | public class AtlasServiceException extends RuntimeException {
4 | public AtlasServiceException(String message) {
5 | super(message);
6 | }
7 |
8 | public AtlasServiceException(Throwable cause) {
9 | super(cause);
10 | }
11 |
12 | public AtlasServiceException(Throwable cause, String message) {
13 | super(message, cause);
14 | }
15 |
16 | public static AtlasServiceException newAtlasException(String message, Object... params) {
17 | if (params != null && params.length > 0) {
18 | String format = String.format(message, params);
19 | if (params[params.length - 1] instanceof Throwable) {
20 | return new AtlasServiceException((Throwable) params[params.length - 1], format);
21 | } else {
22 | return new AtlasServiceException(format);
23 | }
24 | } else {
25 | return new AtlasServiceException(message);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/common/utils/ConvertUtils.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.common.utils;
2 |
3 | import com.ppdai.atlas.dto.PageDto;
4 | import org.springframework.beans.BeanUtils;
5 | import org.springframework.data.domain.Page;
6 |
7 | import java.util.List;
8 | import java.util.function.Function;
9 | import java.util.stream.Collectors;
10 | import java.util.stream.StreamSupport;
11 |
12 | public class ConvertUtils {
13 |
14 | private ConvertUtils() {
15 |
16 | }
17 | /**
18 | * copy properties from s to t
19 | *
20 | * @param s source instance
21 | * @param t dest instance
22 | * @param
23 | * @param
24 | * @return
25 | */
26 | public static T convert(S s, T t) {
27 | BeanUtils.copyProperties(s, t);
28 | return t;
29 |
30 | }
31 |
32 | public static T convert(S s, T t, String... ignoreProperties) {
33 | BeanUtils.copyProperties(s, t, ignoreProperties);
34 | return t;
35 | }
36 |
37 | public static T convert(S s, Class tClass) {
38 | try {
39 | T t = tClass.newInstance();
40 | BeanUtils.copyProperties(s, t);
41 | return t;
42 | } catch (Exception e) {
43 | throw new RuntimeException(e);
44 | }
45 | }
46 |
47 | public static List convert(Iterable sIterable, Function super S, ? extends T> mapper) {
48 | return StreamSupport.stream(sIterable.spliterator(), false).map(mapper).collect(Collectors.toList());
49 | }
50 |
51 | public static List convert(Iterable sIterable, Class tClass) {
52 | return convert(sIterable, a -> convert(a, tClass));
53 | }
54 |
55 | public static PageDto convertPage(Page page, Function super S, ? extends T> mapper) {
56 | List contents = page.getContent();
57 | List tContents = convert(contents, mapper);
58 | PageDto pageDto = new PageDto<>();
59 | pageDto.setContent(tContents);
60 | pageDto.setFirst(page.isFirst());
61 | pageDto.setLast(page.isLast());
62 | pageDto.setNumber(page.getNumber());
63 | pageDto.setSize(page.getSize());
64 | pageDto.setNumberOfElements(page.getNumberOfElements());
65 | pageDto.setTotalElements(page.getTotalElements());
66 | pageDto.setTotalPages(page.getTotalPages());
67 | return pageDto;
68 | }
69 |
70 | public static PageDto convertPage(Page page, Class tClass) {
71 | return convertPage(page, a -> convert(a, tClass));
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/config/HttpClientBeanConfig.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.config;
2 |
3 | import com.ppdai.atlas.client.JsonHttpClient;
4 | import org.springframework.beans.factory.annotation.Value;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * Created by zhangyicong on 18-7-25.
10 | */
11 |
12 | @Configuration
13 | public class HttpClientBeanConfig {
14 |
15 | @Value("${alertmanager.connTimeout:1000}")
16 | private int casConnTimeout;
17 |
18 | @Value("${alertmanager.readTimeout:1000}")
19 | private int casReadTimeout;
20 |
21 | @Bean(name = "alertManagerHttpClient")
22 | public JsonHttpClient alertManagerHttpClient() {
23 | return new JsonHttpClient(casConnTimeout, casReadTimeout);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/config/JacksonConfig.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.config;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import com.fasterxml.jackson.databind.ObjectMapper;
5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.context.annotation.Primary;
9 |
10 | import java.text.SimpleDateFormat;
11 |
12 | /**
13 | * Created by yinzuolong on 2017/7/31.
14 | */
15 |
16 |
17 | @Configuration
18 | public class JacksonConfig {
19 |
20 | @Bean
21 | @Primary
22 | @ConditionalOnMissingBean(ObjectMapper.class)
23 | public ObjectMapper jacksonObjectMapper() {
24 | ObjectMapper objectMapper = new ObjectMapper();
25 | objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
26 | objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"));
27 | return objectMapper;
28 | }
29 |
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/config/JpaConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.config;
2 |
3 |
4 | import com.ppdai.atlas.dao.AuditLogRepository;
5 | import com.ppdai.auth.utils.PauthTokenUtil;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.data.domain.AuditorAware;
9 | import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
10 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
11 |
12 |
13 | @Configuration
14 | @EnableJpaRepositories(basePackageClasses = {AuditLogRepository.class})
15 | @EnableJpaAuditing
16 | public class JpaConfiguration {
17 |
18 |
19 | @Bean
20 | AuditorAware auditorProvider(PauthTokenUtil pauthTokenUtil) {
21 | return new UserAuditorAware(pauthTokenUtil);
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/config/MappingConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.config;
2 |
3 | import org.dozer.spring.DozerBeanMapperFactoryBean;
4 | import org.springframework.beans.factory.annotation.Value;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.core.io.Resource;
8 |
9 | /**
10 | * Created by liujingyu on 2018/7/7.
11 | */
12 | @Configuration
13 | public class MappingConfiguration {
14 |
15 | @Bean
16 | public DozerBeanMapperFactoryBean dozerBeanMapperFactoryBean(@Value("classpath*:dozer/*.xml") Resource[] resources) {
17 | final DozerBeanMapperFactoryBean dozerBeanMapperFactoryBean = new DozerBeanMapperFactoryBean();
18 | dozerBeanMapperFactoryBean.setMappingFiles(resources);
19 | return dozerBeanMapperFactoryBean;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/config/SwaggerConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.config;
2 |
3 | import org.springframework.beans.factory.annotation.Value;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.context.annotation.Configuration;
6 | import springfox.documentation.builders.ApiInfoBuilder;
7 | import springfox.documentation.builders.PathSelectors;
8 | import springfox.documentation.builders.RequestHandlerSelectors;
9 | import springfox.documentation.service.ApiInfo;
10 | import springfox.documentation.service.StringVendorExtension;
11 | import springfox.documentation.spi.DocumentationType;
12 | import springfox.documentation.spring.web.plugins.Docket;
13 | import springfox.documentation.swagger2.annotations.EnableSwagger2;
14 |
15 | import java.util.Arrays;
16 |
17 | /**
18 | * Created by qiankai02 on 2017/11/14.
19 | */
20 | @Configuration
21 | @EnableSwagger2
22 | public class SwaggerConfiguration {
23 |
24 | private ApiInfo apiInfo() {
25 | return new ApiInfoBuilder()
26 | .title("atlas")
27 | .version("1.0.0")
28 | .build();
29 | }
30 |
31 | @Bean
32 | public Docket api() {
33 | return new Docket(DocumentationType.SWAGGER_2)
34 | .select()
35 | .apis(RequestHandlerSelectors.basePackage("com.ppdai.atlas.controller"))
36 | .paths(PathSelectors.any())
37 | .build()
38 | .apiInfo(apiInfo());
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/config/UserAuditorAware.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.config;
2 |
3 | import com.ppdai.auth.common.identity.Identity;
4 | import com.ppdai.auth.utils.PauthTokenUtil;
5 | import lombok.extern.slf4j.Slf4j;
6 | import org.springframework.data.domain.AuditorAware;
7 | import org.springframework.web.context.request.RequestContextHolder;
8 | import org.springframework.web.context.request.ServletRequestAttributes;
9 |
10 | import javax.servlet.http.HttpServletRequest;
11 |
12 | @Slf4j
13 | public class UserAuditorAware implements AuditorAware {
14 |
15 | public static final String DEFAULT_SYSTEM_NAME = "system";
16 |
17 | private PauthTokenUtil pauthTokenUtil;
18 |
19 | public UserAuditorAware(PauthTokenUtil pauthTokenUtil) {
20 | this.pauthTokenUtil = pauthTokenUtil;
21 | }
22 |
23 | @Override
24 | public String getCurrentAuditor() {
25 | String userName = DEFAULT_SYSTEM_NAME;
26 |
27 | try {
28 | ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
29 | if (requestAttributes != null) {
30 | HttpServletRequest request = requestAttributes.getRequest();
31 |
32 | Identity tokenInfo = pauthTokenUtil.getTokenInfo(request);
33 | userName = tokenInfo.getName();
34 | }
35 | } catch (Exception e) {
36 | log.error("Not able to read the user name by servlet requests. Probably it's a system call. ex=" + e.getMessage(), e);
37 | }
38 |
39 | return userName;
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/controller/ApplyController.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.controller;
2 |
3 | import com.ppdai.atlas.controller.response.MessageType;
4 | import com.ppdai.atlas.controller.response.Response;
5 | import com.ppdai.atlas.dto.*;
6 | import com.ppdai.atlas.enums.ApplyStatusEnum;
7 | import com.ppdai.atlas.enums.ApplyTypeEnum;
8 | import com.ppdai.atlas.service.*;
9 | import com.ppdai.atlas.vo.PageVO;
10 | import com.ppdai.auth.utils.PauthTokenUtil;
11 |
12 | import lombok.extern.slf4j.Slf4j;
13 | import org.springframework.beans.factory.annotation.Autowired;
14 | import org.springframework.web.bind.annotation.*;
15 |
16 |
17 | @RestController
18 | @RequestMapping("/web/apply")
19 | @Slf4j
20 | public class ApplyController {
21 |
22 | @Autowired
23 | private PauthTokenUtil pauthTokenUtil;
24 |
25 | @Autowired
26 | private ApplyService applyService;
27 |
28 | @PostMapping(value = "/createApply")
29 | public Response createApply(@RequestBody ApplyDto applyDto) {
30 | return Response.success(applyService.create(applyDto));
31 | }
32 |
33 | @GetMapping(value = "/queryByPage")
34 | public Response> queryByPage(@RequestParam(value = "applyUser", required = false) String applyUser,
35 | @RequestParam(value = "status", required = false) String status,
36 | @RequestParam(value = "page") Integer page,
37 | @RequestParam(value = "size") Integer size) {
38 | PageVO sitePageVO = applyService.getByPage(applyUser, status, page, size);
39 | return Response.mark(MessageType.SUCCESS, sitePageVO);
40 | }
41 |
42 | @PostMapping(value = "/updateStatus")
43 | public Response updateStatus(@RequestBody UpdateApplyStatusDto request) {
44 |
45 | ApplyDto applyDto = applyService.getById(request.getApplyId());
46 | applyDto.setStatus(request.getStatus());
47 | applyDto.setResult(request.getResult());
48 | applyDto.setOpUser(pauthTokenUtil.getTokenInfo().getName());
49 |
50 | if (applyDto.getType().equals(ApplyTypeEnum.NEW_APP.name())
51 | && request.getStatus().equals(ApplyStatusEnum.DONE.name())
52 | && !applyDto.getStatus().equals(ApplyStatusEnum.DONE.name())) {
53 | applyService.autoCreateApp(applyDto);
54 | }
55 |
56 | applyService.update(applyDto);
57 | return Response.success("OK");
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/controller/EnvController.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.controller;
2 |
3 | import com.ppdai.atlas.dto.EnvDto;
4 | import com.ppdai.atlas.dto.PageDto;
5 | import com.ppdai.atlas.dto.Response;
6 | import com.ppdai.atlas.dto.query.EnvQuery;
7 | import com.ppdai.atlas.service.EnvService;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.web.bind.annotation.*;
11 |
12 | import java.util.List;
13 | import java.util.Optional;
14 |
15 | @Slf4j
16 | @RestController
17 | @RequestMapping("/web/envs")
18 | public class EnvController {
19 |
20 | @Autowired
21 | private EnvService envService;
22 |
23 | @GetMapping(value = "/all")
24 | public Response> getAllEnvs() {
25 | List allEnvs = envService.getAllEnvs();
26 | return Response.success(allEnvs);
27 | }
28 |
29 | @GetMapping(value = "/page")
30 | public Response> getEnvsInPage(@RequestParam Integer page, @RequestParam Integer size) {
31 | PageDto envInPage = envService.getEnvsByPage(page, size);
32 | return Response.success(envInPage);
33 | }
34 |
35 | @GetMapping(value = "/{envId}")
36 | public Response getEnvById(@PathVariable("envId") Long id) {
37 | Optional envDto = envService.getEnvById(id);
38 | return Response.success(envDto.orElse(null));
39 | }
40 |
41 | @PostMapping(value = "")
42 | public Response createEnv(@RequestBody EnvDto envDto) {
43 | envDto = envService.addEnv(envDto);
44 | return Response.success(envDto);
45 | }
46 |
47 | @PutMapping(value = "")
48 | public Response updateEnv(@RequestBody EnvDto envDto) {
49 | envDto = envService.updateEnv(envDto);
50 | return Response.success(envDto);
51 | }
52 |
53 | @DeleteMapping(value = "/{envId}")
54 | public Response deleteEnv(@PathVariable("envId") Long id) {
55 | envService.removeEnv(id);
56 | return Response.success("env delete success");
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/controller/HSController.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.controller;
2 |
3 | import org.springframework.web.bind.annotation.GetMapping;
4 | import org.springframework.web.bind.annotation.RestController;
5 |
6 | @RestController
7 | public class HSController {
8 |
9 | @GetMapping("/hs")
10 | public String healthcheck() {
11 | return "OK";
12 | }
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/controller/OrgController.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.controller;
2 |
3 | import com.ppdai.atlas.dto.OrgDto;
4 | import com.ppdai.atlas.dto.PageDto;
5 | import com.ppdai.atlas.dto.Response;
6 | import com.ppdai.atlas.dto.query.OrgQuery;
7 | import com.ppdai.atlas.service.OrgService;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.web.bind.annotation.*;
11 |
12 | import java.util.List;
13 | import java.util.Optional;
14 |
15 | @Slf4j
16 | @RestController
17 | @RequestMapping("/web/orgs")
18 | public class OrgController {
19 |
20 | private final OrgService orgService;
21 |
22 | @Autowired
23 | public OrgController(OrgService orgService) {
24 | this.orgService = orgService;
25 | }
26 |
27 | @GetMapping(value = "/{orgId}")
28 | public Response getOrgById(@PathVariable("orgId") Long id) {
29 | Optional orgDto = orgService.getOrgById(id);
30 | return Response.success(orgDto.orElse(null));
31 | }
32 |
33 | @GetMapping(value = "/all")
34 | public Response> getAllOrgs() {
35 | List orgDtos = orgService.getAllOrgs();
36 | return Response.success(orgDtos);
37 | }
38 |
39 | @GetMapping(value = "/page")
40 | public Response> getOrgsByPage(@RequestParam Integer page, @RequestParam Integer size) {
41 | PageDto orgDtoPageDto = orgService.getOrgsByPage(page, size);
42 | return Response.success(orgDtoPageDto);
43 | }
44 |
45 | @GetMapping(value = "/condition")
46 | public Response> getOrgsByCondition(@RequestParam Integer page, @RequestParam Integer size,
47 | OrgQuery orgQuery) throws Exception {
48 | PageDto orgDtoPageDto = orgService.getOrgsByCondition(page, size, orgQuery);
49 | return Response.success(orgDtoPageDto);
50 | }
51 |
52 | @PostMapping(value = "")
53 | public Response addOrg(@RequestBody OrgDto orgDto) {
54 | orgDto = orgService.addOrg(orgDto);
55 | return Response.success(orgDto);
56 | }
57 |
58 | @PutMapping(value = "")
59 | public Response updateOrg(@RequestBody OrgDto orgDto) {
60 | OrgDto updateOrg = orgService.updateOrg(orgDto);
61 | return Response.success(updateOrg);
62 | }
63 |
64 | @DeleteMapping(value = "/{orgId}")
65 | public Response deleteOrg(@PathVariable("orgId") Long id) {
66 | orgService.removeOrgById(id);
67 | return Response.success("delete org success");
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/controller/RoleController.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.controller;
2 |
3 | import com.ppdai.atlas.dto.PageDto;
4 | import com.ppdai.atlas.dto.Response;
5 | import com.ppdai.atlas.dto.RoleDto;
6 | import com.ppdai.atlas.dto.query.RoleQuery;
7 | import com.ppdai.atlas.service.RoleService;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.web.bind.annotation.*;
11 |
12 | import java.util.List;
13 | import java.util.Optional;
14 |
15 |
16 | @Slf4j
17 | @RestController
18 | @RequestMapping("/web/roles")
19 | public class RoleController {
20 |
21 | private final RoleService roleService;
22 |
23 | @Autowired
24 | public RoleController(RoleService roleService) {
25 | this.roleService = roleService;
26 | }
27 |
28 | @GetMapping(value = "/{roleId}")
29 | public Response getRoleById(@PathVariable("roleId") Long id) {
30 | Optional roleDto = roleService.getRoleById(id);
31 | return Response.success(roleDto.orElse(null));
32 | }
33 |
34 | @GetMapping(value = "/all")
35 | public Response> getAllRoles() {
36 | List roleDtos = roleService.getAllRoles();
37 | return Response.success(roleDtos);
38 | }
39 |
40 | @GetMapping(value = "/page")
41 | public Response> getRoleByPage(@RequestParam Integer page, @RequestParam Integer size) {
42 | PageDto roleDtoByPage = roleService.getRolesByPage(page, size);
43 | return Response.success(roleDtoByPage);
44 | }
45 |
46 | @GetMapping(value = "/condition")
47 | public Response> getRoleByCondition(@RequestParam Integer page, @RequestParam Integer size,
48 | RoleQuery roleQuery) {
49 | PageDto roleDtoByPage = roleService.getRolesByCondition(page, size, roleQuery);
50 | return Response.success(roleDtoByPage);
51 | }
52 |
53 | @PostMapping(value = "")
54 | public Response addRole(@RequestBody RoleDto roleDto) {
55 | roleDto = roleService.addRole(roleDto);
56 | return Response.success(roleDto);
57 | }
58 |
59 | @PutMapping(value = "")
60 | public Response updateRole(@RequestBody RoleDto roleDto) {
61 | RoleDto updateRole = roleService.updateRole(roleDto);
62 | return Response.success(updateRole);
63 | }
64 |
65 | @DeleteMapping(value = "/{roleId}")
66 | public Response deleteRole(@PathVariable("roleId") Long id) {
67 | roleService.removeRoleById(id);
68 | return Response.success("delete role success");
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/controller/SpecTypeController.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.controller;
2 |
3 | import com.ppdai.atlas.dto.PageDto;
4 | import com.ppdai.atlas.dto.Response;
5 | import com.ppdai.atlas.dto.SpecTypeDto;
6 | import com.ppdai.atlas.dto.query.SpecTypeQuery;
7 | import com.ppdai.atlas.service.SpecTypeService;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.web.bind.annotation.*;
11 |
12 | import java.util.List;
13 | import java.util.Optional;
14 |
15 |
16 | /**
17 | * Created by qiankai02 on 2017/11/13.
18 | */
19 | @Slf4j
20 | @RestController
21 | @RequestMapping("/web/specTypes")
22 | public class SpecTypeController {
23 |
24 | private final SpecTypeService specTypeService;
25 |
26 | @Autowired
27 | public SpecTypeController(SpecTypeService specTypeService) {
28 | this.specTypeService = specTypeService;
29 | }
30 |
31 | @GetMapping(value = "/{specTypeId}")
32 | public Response getSpecTypeById(@PathVariable("specTypeId") Long id) {
33 | Optional specTypeById = specTypeService.getSpecTypeById(id);
34 | return Response.success(specTypeById.orElse(null));
35 | }
36 |
37 | @GetMapping(value = "/all")
38 | public Response> getAllSpecTypes() {
39 | List allSpecTypes = specTypeService.getAllSpecTypes();
40 | return Response.success(allSpecTypes);
41 | }
42 |
43 | @GetMapping(value = "/page")
44 | public Response> getSpecTypeByPage(@RequestParam Integer page, @RequestParam Integer size) {
45 | PageDto specTypesByPage = specTypeService.getSpecTypesByPage(page, size);
46 | return Response.success(specTypesByPage);
47 | }
48 |
49 | @GetMapping(value = "/condition")
50 | public Response> getSpecTypeByCondition(@RequestParam Integer page, @RequestParam Integer size,
51 | SpecTypeQuery specTypeQuery) {
52 | PageDto specTypesByPage = specTypeService.getSpecTypesByCondition(page, size, specTypeQuery);
53 | return Response.success(specTypesByPage);
54 | }
55 |
56 | @PostMapping(value = "")
57 | public Response addSpecType(@RequestBody SpecTypeDto specTypeDto) {
58 | specTypeDto = specTypeService.addSpecType(specTypeDto);
59 | return Response.success(specTypeDto);
60 | }
61 |
62 | @PutMapping(value = "")
63 | public Response updateSpecType(@RequestBody SpecTypeDto specTypeDto) {
64 | SpecTypeDto updateSpecType = specTypeService.updateSpecType(specTypeDto);
65 | return Response.success(updateSpecType);
66 | }
67 |
68 | @DeleteMapping(value = "/{specTypeId}")
69 | public Response deleteSpecType(@PathVariable("specTypeId") Long id) {
70 | specTypeService.removeSpecTypeById(id);
71 | return Response.success("delete specTypeDto success");
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/controller/UserExtController.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.controller;
2 |
3 | import com.ppdai.atlas.dto.Response;
4 | import com.ppdai.atlas.dto.UserExtDto;
5 | import com.ppdai.atlas.service.UserExtService;
6 | //import com.ppdai.authority.annotation.AuthorityAnnotation;
7 | import lombok.extern.slf4j.Slf4j;
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.web.bind.annotation.*;
10 |
11 | @Slf4j
12 | @RestController
13 | @RequestMapping("/web/userexts")
14 | public class UserExtController {
15 |
16 | @Autowired
17 | private UserExtService userExtService;
18 |
19 | @PostMapping(name = "/")
20 | public Response addUserExt(@RequestBody UserExtDto userExtDto) {
21 | userExtService.removeUserExtByWorkNumber(userExtDto.getUserWorkNumber());
22 | userExtService.addUserExt(userExtDto);
23 | return Response.success("success");
24 | }
25 |
26 | @GetMapping(name = "/")
27 | public Response getUserExtDtoByWorkNumber(@RequestParam String workNumber) {
28 | UserExtDto userExtDto = userExtService.findUserExtByWorkNumber(workNumber);
29 | return Response.success(userExtDto);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/controller/ZoneController.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.controller;
2 |
3 | import com.ppdai.atlas.dto.PageDto;
4 | import com.ppdai.atlas.dto.Response;
5 | import com.ppdai.atlas.dto.ZoneDto;
6 | import com.ppdai.atlas.service.ZoneService;
7 | //import com.ppdai.authority.annotation.AuthorityAnnotation;
8 | import lombok.extern.slf4j.Slf4j;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.web.bind.annotation.*;
11 |
12 | import java.util.List;
13 | import java.util.Optional;
14 |
15 | @Slf4j
16 | @RestController
17 | @RequestMapping("/web/zones")
18 | public class ZoneController {
19 |
20 | @Autowired
21 | private ZoneService zoneService;
22 |
23 | @GetMapping(value = "/all")
24 | public Response> getAllZones() {
25 | List allZones = zoneService.getAllZones();
26 | return Response.success(allZones);
27 | }
28 |
29 | @GetMapping(value = "/page")
30 | public Response getZonesInPage(@RequestParam Integer page, @RequestParam Integer size) {
31 | PageDto zoneInPage = zoneService.getZoneInPage(page, size);
32 | return Response.success(zoneInPage);
33 | }
34 |
35 | @GetMapping(value = "/condition")
36 | public Response searchZonesByEnvAndName(@RequestParam Integer page, @RequestParam Integer size,
37 | @RequestParam String envName, @RequestParam String zoneName) {
38 | PageDto cloudInPage = zoneService.searchZoneByEnvAndName(page, size, envName, zoneName);
39 | return Response.success(cloudInPage);
40 | }
41 |
42 | @GetMapping(value = "/{zoneId}")
43 | public Response getZoneById(@PathVariable("zoneId") Long id) {
44 | Optional zoneDto = zoneService.getZoneById(id);
45 | return Response.success(zoneDto.orElse(null));
46 | }
47 |
48 | @PostMapping(value = "")
49 | public Response createZone(@RequestBody ZoneDto zoneDto) {
50 | zoneDto = zoneService.addOrUpdateZone(zoneDto);
51 | return Response.success(zoneDto);
52 | }
53 |
54 | @PutMapping(value = "")
55 | public Response updateZone(@RequestBody ZoneDto zoneDto) {
56 | zoneDto = zoneService.addOrUpdateZone(zoneDto);
57 | return Response.success(zoneDto);
58 | }
59 |
60 | @DeleteMapping(value = "/{zoneId}")
61 | public Response deleteZone(@PathVariable("zoneId") Long id) {
62 | zoneService.deleteZone(id);
63 | return Response.success("cloud delete success");
64 | }
65 |
66 | @GetMapping(value = "/getByEnv")
67 | public Response> getByEnv(@RequestParam String env) {
68 | List zoneDtos = zoneService.getZonesByEnv(env);
69 | return Response.success(zoneDtos);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/controller/response/MessageType.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.controller.response;
2 |
3 | public enum MessageType {
4 |
5 | SUCCESS(0, "请求成功完成。"),
6 | ERROR(-1, "发现错误。"),
7 | UNKNOWN(-2, "未知错误。");
8 |
9 | private Integer code;
10 | private String msg;
11 |
12 | MessageType(Integer code, String msg) {
13 | this.code = code;
14 | this.msg = msg;
15 | }
16 |
17 | public Integer getCode() {
18 | return this.code;
19 | }
20 |
21 | public String getMsg() {
22 | return this.msg;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/controller/response/Response.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.controller.response;
2 |
3 | public class Response {
4 |
5 | private Integer code;
6 | private String message;
7 | private T detail;
8 |
9 | public static Response mark(MessageType type) {
10 | return mark(type, null);
11 | }
12 |
13 | public static Response mark(MessageType type, T detail) {
14 | Response response = new Response<>();
15 | response.code = type.getCode();
16 | response.message = type.getMsg();
17 | response.detail = detail;
18 | return response;
19 | }
20 |
21 | public static Response mark(MessageType type, String message, Object... params){
22 | Response response;
23 |
24 | if (params != null && params.length > 0) {
25 | String formatMessage = String.format(message, params);
26 | response = Response.mark(type, formatMessage);
27 | } else {
28 | response = Response.mark(type, message);
29 | }
30 |
31 | return response;
32 | }
33 |
34 | public static Response success(T detail) {
35 | Response response = new Response<>();
36 | response.code = MessageType.SUCCESS.getCode();
37 | response.message = MessageType.SUCCESS.getMsg();
38 | response.detail = detail;
39 | return response;
40 | }
41 |
42 | public static Response error(T detail) {
43 | Response response = new Response<>();
44 | response.code = MessageType.ERROR.getCode();
45 | response.message = MessageType.ERROR.getMsg();
46 | response.detail = detail;
47 | return response;
48 | }
49 |
50 | public Integer getCode() {
51 | return code;
52 | }
53 |
54 | public void setCode(Integer code) {
55 | this.code = code;
56 | }
57 |
58 | public String getMessage() {
59 | return message;
60 | }
61 |
62 | public void setMessage(String message) {
63 | this.message = message;
64 | }
65 |
66 | public T getDetails() {
67 | return detail;
68 | }
69 |
70 | public void setDetails(T result) {
71 | this.detail = result;
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/AppQuotaRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.AppQuotaEntity;
4 | import org.springframework.data.domain.Page;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.jpa.domain.Specification;
7 | import org.springframework.data.jpa.repository.Modifying;
8 | import org.springframework.data.jpa.repository.Query;
9 |
10 | import java.util.List;
11 |
12 | public interface AppQuotaRepository extends BaseJpaRepository {
13 |
14 | @Override
15 | @Query("select a from AppQuotaEntity a where a.isActive=true order by a.id")
16 | List findAll();
17 |
18 | @Query("select a from AppQuotaEntity a where a.isActive=true and a.id=?1")
19 | AppQuotaEntity findOneById(Long id);
20 |
21 | @Query("select a from AppQuotaEntity a where a.isActive=true and a.appId=?1 and a.envId=?2 and a.spectypeId=?3")
22 | AppQuotaEntity findOneByAppEnvSpec(String appId, Long envId, Long spectypeId);
23 |
24 | @Query("select a from AppQuotaEntity a where a.isActive=true order by a.id")
25 | @Override
26 | Page findAll(Pageable pageable);
27 |
28 | @Modifying(clearAutomatically = true)
29 | @Query("update AppQuotaEntity a set a.isActive=false where a.id=?1")
30 | void removeOneEntityById(Long id);
31 |
32 | @Query("select a from AppQuotaEntity a where a.isActive=true and a.appId=?1 and a.envId=?2")
33 | List findAllByAppIdAndEnvId(String appId, Long envId);
34 |
35 | @Query("select a from AppQuotaEntity a where a.isActive=true and a.appId=?1")
36 | List findAllAppQuotaByAppId(String appId);
37 |
38 | Page findAll(Specification specification, Pageable pageRequest);
39 |
40 | @Query("select a from AppQuotaEntity a where a.isActive=true and a.appId=?1 and a.envId=?2 and a.spectypeId=?3")
41 | AppQuotaEntity findByAppIdEnvIdAndSpecId(String appId, long envId, long specId);
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/AppRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.AppEntity;
4 | import org.springframework.data.domain.Page;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.jpa.domain.Specification;
7 | import org.springframework.data.jpa.repository.Modifying;
8 | import org.springframework.data.jpa.repository.Query;
9 | import org.springframework.data.repository.query.Param;
10 |
11 | import java.util.List;
12 |
13 |
14 | public interface AppRepository extends BaseJpaRepository {
15 | @Override
16 | @Query("select a from AppEntity a where a.isActive=true order by a.id")
17 | List findAll();
18 |
19 | @Query("select a from AppEntity a where a.isActive=true and a.orgId=?1 order by a.id")
20 | List findAllByOrgId(Long id);
21 |
22 | @Query("select a from AppEntity a where a.isActive=true and a.appId=?1")
23 | AppEntity findOneByAppId(String id);
24 |
25 | @Query("select a from AppEntity a where a.appId=?1")
26 | AppEntity findOneByAppIdNoCareActive(String id);
27 |
28 | @Query("select a from AppEntity a where a.isActive=true and a.id=?1")
29 | AppEntity findOneByAutoIncreId(Long id);
30 |
31 | @Query("select a from AppEntity a where a.isActive=true and a.name=?1")
32 | AppEntity findAppByAppName(String appName);
33 |
34 | @Query("select a from AppEntity a where a.name=?1")
35 | AppEntity findAppByNameNotCareActive(String appName);
36 |
37 | @Query("select a from AppEntity a where a.isActive=true order by a.id")
38 | @Override
39 | Page findAll(Pageable pageable);
40 |
41 | @Modifying(clearAutomatically = true)
42 | @Query("update AppEntity a set a.isActive=false where a.id=?1")
43 | void removeOneEntityById(Long id);
44 |
45 | Page findAll(Specification specification, Pageable pageable);
46 |
47 | @Query("SELECT a FROM AppEntity a where a.isActive=true and a.name LIKE CONCAT('%',:appName,'%') order by a.id")
48 | List fuzzyFindByAppName(@Param("appName") String appName);
49 |
50 | //按负责人和test来查
51 | @Query("select a from AppEntity a where a.isActive=true and (a.developers LIKE CONCAT('%',:developers,'%') or a.tests LIKE CONCAT('%',:developers,'%')) order by a.id")
52 | List findAppsByUserWorkNumber(@Param("developers")String userWorkNumber);
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/ApplyRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 |
4 | import com.ppdai.atlas.entity.ApplyEntity;
5 | import org.springframework.data.jpa.repository.JpaRepository;
6 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
7 |
8 | public interface ApplyRepository extends JpaRepository, JpaSpecificationExecutor {
9 | }
10 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/AuditLogRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.AuditLogEntity;
4 | import org.springframework.data.repository.CrudRepository;
5 |
6 | public interface AuditLogRepository extends CrudRepository {
7 | }
8 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/BaseJpaRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import org.springframework.data.jpa.repository.JpaRepository;
4 | import org.springframework.data.repository.NoRepositoryBean;
5 |
6 | import java.io.Serializable;
7 |
8 | @NoRepositoryBean
9 | public interface BaseJpaRepository extends JpaRepository {
10 | Iterable findByIsActiveIsTrue();
11 |
12 | default Iterable getAll() {
13 | return findByIsActiveIsTrue();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/EnvRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.EnvEntity;
4 | import org.springframework.data.domain.Page;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.jpa.domain.Specification;
7 | import org.springframework.data.jpa.repository.Modifying;
8 | import org.springframework.data.jpa.repository.Query;
9 |
10 | import java.util.List;
11 |
12 | public interface EnvRepository extends BaseJpaRepository {
13 |
14 | @Override
15 | @Query("SELECT a FROM EnvEntity a WHERE a.isActive=true order by a.id")
16 | List findAll();
17 |
18 | @Override
19 | @Query("SELECT a From EnvEntity a WHERE a.isActive=true order by a.id")
20 | Page findAll(Pageable pageable);
21 |
22 | @Modifying(clearAutomatically = true)
23 | @Query("UPDATE EnvEntity a SET a.isActive=false WHERE a.id=?1")
24 | int removeEnvEntity(Long id);
25 |
26 | @Query("SELECT a FROM EnvEntity a WHERE a.isActive=true and a.id=?1")
27 | EnvEntity findOneById(Long id);
28 |
29 | @Query("select a from EnvEntity a where a.isActive=true and a.name=?1")
30 | EnvEntity findOneByName(String name);
31 |
32 | @Query("SELECT a from EnvEntity a where a.name=?1 and a.isActive=?2")
33 | EnvEntity findOneByNameAndActive(String envName, boolean isActive);
34 |
35 | Page findAll(Specification spec, Pageable page);
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/LockRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.LockEntity;
4 | import org.springframework.data.jpa.repository.Modifying;
5 | import org.springframework.data.jpa.repository.Query;
6 |
7 | import java.util.Date;
8 |
9 |
10 | public interface LockRepository extends BaseJpaRepository {
11 |
12 | @Query("SELECT a FROM LockEntity a WHERE a.isActive=true and a.name=?1")
13 | LockEntity findByName(String name);
14 |
15 | @Modifying(clearAutomatically = true)
16 | @Query("UPDATE LockEntity a SET a.version=a.version+1, a.possessor=?3 WHERE a.name=?1 and a.version=?2 and a.updateTime < ?4")
17 | int tryLockBefore(String name, long version, String possessor, Date date);
18 |
19 | @Modifying(clearAutomatically = true)
20 | @Query("UPDATE LockEntity a SET a.possessor='' WHERE a.name=?1 and a.possessor=?2")
21 | void releaseLock(String name, String possessor);
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/OrgRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.OrgEntity;
4 | import org.springframework.data.domain.Page;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.jpa.domain.Specification;
7 | import org.springframework.data.jpa.repository.Modifying;
8 | import org.springframework.data.jpa.repository.Query;
9 |
10 | import java.util.List;
11 |
12 | public interface OrgRepository extends BaseJpaRepository {
13 |
14 | @Override
15 | @Query("select a from OrgEntity a where a.isActive=true order by a.id")
16 | List findAll();
17 |
18 | @Query("select a from OrgEntity a where a.isActive=true and id=?1")
19 | OrgEntity findOneById(Long id);
20 |
21 | @Query("select a from OrgEntity a where a.isActive=true order by a.id")
22 | @Override
23 | Page findAll(Pageable pageable);
24 |
25 | @Modifying(clearAutomatically = true)
26 | @Query("update OrgEntity a set a.isActive=false where a.id=?1")
27 | void removeOneEntityById(Long id);
28 |
29 | Page findAll(Specification specification, Pageable pageable);
30 |
31 | @Query("select a from OrgEntity a where a.orgCode=?1 and a.isActive=true")
32 | OrgEntity findOrgByOrgCode(String orgCode);
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/QuotaRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.QuotaEntity;
4 | import org.springframework.data.domain.Page;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.jpa.domain.Specification;
7 | import org.springframework.data.jpa.repository.Modifying;
8 | import org.springframework.data.jpa.repository.Query;
9 |
10 | import java.util.List;
11 |
12 |
13 | public interface QuotaRepository extends BaseJpaRepository {
14 | @Override
15 | @Query("select a from QuotaEntity a where a.isActive=true order by a.id")
16 | List findAll();
17 |
18 | @Query("select a from QuotaEntity a where a.isActive=true and a.id=?1")
19 | QuotaEntity findOneById(Long id);
20 |
21 | @Query("select a from QuotaEntity a where a.isActive=true and a.orgId=?1 and a.envId=?2")
22 | QuotaEntity findOneByOrgEnv(Long orgId, Long envId);
23 |
24 | @Query("select a from QuotaEntity a where a.isActive=true order by a.id")
25 | @Override
26 | Page findAll(Pageable pageable);
27 |
28 | @Modifying(clearAutomatically = true)
29 | @Query("update QuotaEntity a set a.isActive=false where a.id=?1")
30 | void removeOneEntityById(Long id);
31 |
32 | Page findAll(Specification specification, Pageable pageRequest);
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/RoleRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.RoleEntity;
4 | import org.springframework.data.domain.Page;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.jpa.domain.Specification;
7 | import org.springframework.data.jpa.repository.Modifying;
8 | import org.springframework.data.jpa.repository.Query;
9 |
10 | import java.util.List;
11 |
12 | public interface RoleRepository extends BaseJpaRepository {
13 |
14 | @Override
15 | @Query("select a from RoleEntity a where a.isActive=true order by a.id")
16 | List findAll();
17 |
18 | @Query("select a from RoleEntity a where a.isActive=true and id=?1")
19 | RoleEntity findOneById(Long id);
20 |
21 | @Query("select a from RoleEntity a where a.isActive=true order by a.id")
22 | Page findAll(Pageable pageable);
23 |
24 | @Modifying(clearAutomatically = true)
25 | @Query("update RoleEntity a set a.isActive=false where a.id=?1")
26 | void removeOneEntityById(Long id);
27 |
28 | @Query("select a from RoleEntity a where a.isActive=true and a.name=?1")
29 | RoleEntity findOneByName(String roleName);
30 |
31 | Page findAll(Specification specification, Pageable pageable);
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/SpecTypeRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.SpecTypeEntity;
4 | import org.springframework.data.domain.Page;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.jpa.domain.Specification;
7 | import org.springframework.data.jpa.repository.Modifying;
8 | import org.springframework.data.jpa.repository.Query;
9 |
10 | import java.util.List;
11 |
12 | public interface SpecTypeRepository extends BaseJpaRepository {
13 |
14 | @Override
15 | @Query("select a from SpecTypeEntity a where a.isActive=true order by a.id")
16 | List findAll();
17 |
18 | @Query("select a from SpecTypeEntity a where a.isActive=true and id=?1")
19 | SpecTypeEntity findOneById(Long id);
20 |
21 | @Query("select a from SpecTypeEntity a where a.isActive=true order by a.id")
22 | Page findAll(Pageable pageable);
23 |
24 | @Modifying(clearAutomatically = true)
25 | @Query("update SpecTypeEntity a set a.isActive=false where a.id=?1")
26 | void removeOneEntityById(Long id);
27 |
28 | @Query("select a from SpecTypeEntity a where a.isActive=true and a.name=?1")
29 | SpecTypeEntity findOneByName(String name);
30 |
31 | Page findAll(Specification specification, Pageable pageable);
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/UserExtRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 |
4 | import com.ppdai.atlas.entity.UserExtEntity;
5 | import org.springframework.data.domain.Page;
6 | import org.springframework.data.domain.Pageable;
7 | import org.springframework.data.jpa.domain.Specification;
8 | import org.springframework.data.jpa.repository.Query;
9 |
10 | public interface UserExtRepository extends BaseJpaRepository {
11 |
12 | @Query("select a from UserExtEntity a where a.userEntity.workNumber=?1 and a.isActive=true")
13 | UserExtEntity findUserExtByUserWorkNumber(String userWorkNumber);
14 |
15 | Page findAll(Specification specification, Pageable pageable);
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/UserRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.UserEntity;
4 | import org.springframework.data.domain.Page;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.jpa.domain.Specification;
7 | import org.springframework.data.jpa.repository.Modifying;
8 | import org.springframework.data.jpa.repository.Query;
9 | import org.springframework.data.repository.query.Param;
10 |
11 | import java.util.List;
12 |
13 | public interface UserRepository extends BaseJpaRepository {
14 | @Override
15 | @Query("select a from UserEntity a where a.isActive=true order by a.id")
16 | List findAll();
17 |
18 | @Query("select a from UserEntity a where a.isActive=true and a.id=?1")
19 | UserEntity findOneById(Long id);
20 |
21 | @Query("select a from UserEntity a where a.isActive=true and a.workNumber=?1")
22 | List findByWorkNumber(String workNumber);
23 |
24 | @Query("select a from UserEntity a where a.isActive=true order by a.id")
25 | @Override
26 | Page findAll(Pageable pageable);
27 |
28 | @Query("select a from UserEntity a where a.userName=?1")
29 | UserEntity findByUserName(String userName);
30 |
31 | @Query("select a from UserEntity a where a.isActive=true and a.workNumber <> '' and a.userName LIKE CONCAT('%',:userName,'%') order by a.id")
32 | Page fuzzyFindByUserName(@Param("userName") String userName, Pageable pageable);
33 |
34 | @Query("select a from UserEntity a where a.isActive=true and a.source=?1 order by a.ldapUpdateTime desc")
35 | Page findLdapLastUpdateFromSource(String source, Pageable pageable);
36 |
37 | @Query("select a from UserEntity a where a.isActive=false and a.source=?1 order by a.ldapUpdateTime desc")
38 | Page findLdapLastDeleteFromSource(String source, Pageable pageable);
39 |
40 | @Modifying(clearAutomatically = true)
41 | @Query("update UserEntity a set a.isActive=false where a.id=?1")
42 | void removeOneEntityById(Long id);
43 |
44 | Page findAll(Specification specification, Pageable pageable);
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/UserRoleRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.UserRoleEntity;
4 | import org.springframework.data.domain.Page;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.jpa.repository.Modifying;
7 | import org.springframework.data.jpa.repository.Query;
8 |
9 | import java.util.List;
10 |
11 | public interface UserRoleRepository extends BaseJpaRepository {
12 |
13 | @Override
14 | @Query("select a from UserRoleEntity a where a.isActive=true order by a.id")
15 | List findAll();
16 |
17 | @Query("select a from UserRoleEntity a where a.isActive=true and id=?1")
18 | UserRoleEntity findOneById(Long id);
19 |
20 | @Query("select a from UserRoleEntity a where a.isActive=true order by a.id")
21 | @Override
22 | Page findAll(Pageable pageable);
23 |
24 | @Modifying(clearAutomatically = true)
25 | @Query("update UserRoleEntity a set a.isActive=false where a.id=?1")
26 | void removeOneEntityById(Long id);
27 |
28 | @Modifying(clearAutomatically = true)
29 | @Query("update UserRoleEntity a set a.isActive=false where a.userWorkNumber=?1")
30 | void removeEntitiesByUserWorkNumber(String workNumber);
31 |
32 | @Query("select a from UserRoleEntity a where a.isActive=true and a.userWorkNumber=?1")
33 | List findUserRolesByUserWorkNumber(String userWorkNumber);
34 |
35 | @Query("select a from UserRoleEntity a where a.isActive=true and a.userWorkNumber=?1 and a.roleId=?2")
36 | UserRoleEntity findOneByWorkNumberAndRoleId(String userWorkNumber, Long roleId);
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dao/ZoneRepository.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dao;
2 |
3 | import com.ppdai.atlas.entity.ZoneEntity;
4 | import org.springframework.data.domain.Page;
5 | import org.springframework.data.domain.Pageable;
6 | import org.springframework.data.jpa.repository.Modifying;
7 | import org.springframework.data.jpa.repository.Query;
8 | import org.springframework.data.repository.query.Param;
9 |
10 | import java.util.List;
11 |
12 | public interface ZoneRepository extends BaseJpaRepository {
13 |
14 | @Query("SELECT a FROM ZoneEntity a where a.isActive=true order by a.id")
15 | @Override
16 | List findAll();
17 |
18 | @Query("SELECT a FROM ZoneEntity a where a.isActive=true and a.envName=?1")
19 | List findByEnv(String env);
20 |
21 | @Override
22 | @Query("SELECT a FROM ZoneEntity a where a.isActive=true order by a.id")
23 | Page findAll(Pageable pageable);
24 |
25 | @Query("SELECT a FROM ZoneEntity a where a.isActive=true and a.envName LIKE CONCAT('%',:envName,'%') and a.name LIKE CONCAT('%',:zoneName,'%') order by a.id")
26 | Page findByEnvAndName(Pageable pageable, @Param("envName") String envName, @Param("zoneName") String zoneName);
27 |
28 | @Query("SELECT a FROM ZoneEntity a where a.isActive=true AND a.id=?1")
29 | ZoneEntity findOneZoneById(Long id);
30 |
31 | @Modifying(clearAutomatically = true)
32 | @Query("UPDATE ZoneEntity a SET a.isActive=false WHERE a.id=?1")
33 | int removeZoneById(Long id);
34 | }
35 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/AlertNotifyDetailDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.sql.Timestamp;
6 |
7 | @Data
8 | public class AlertNotifyDetailDto {
9 | /** 自增ID **/
10 | private Integer id;
11 |
12 | /** 通知名 **/
13 | private String name;
14 |
15 | /** 通知类型 **/
16 | private String type;
17 |
18 | private String appid;
19 |
20 | /** 接收组名称 **/
21 | private String receiver;
22 |
23 | private Integer ischange;
24 |
25 | /** 值班时长 **/
26 | private Integer dutyTime;
27 |
28 | /** 下次换班时间 **/
29 | private Timestamp nextTime;
30 |
31 | /** 当前值班组 **/
32 | private String currentGroup;
33 |
34 | /** 静默时长 **/
35 | private Integer silenceTime;
36 |
37 | private String description;
38 |
39 | /** 新建时间 **/
40 | private Timestamp inserttime;
41 |
42 | /** 更新时间 **/
43 | private Timestamp updatetime;
44 |
45 | /** 逻辑删除 **/
46 | private Integer isactive;
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/AppDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import com.ppdai.atlas.entity.converter.EnvUrl;
4 | import lombok.Data;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 |
10 | @Data
11 | public class AppDto extends BaseDto {
12 | private Long id;
13 |
14 | private String appId;
15 |
16 | private String name;
17 |
18 | private Long orgId;
19 |
20 | private OrgDto orgDto;
21 |
22 | private String description;
23 |
24 | private String appType;
25 |
26 | private String appLevel;
27 |
28 | private String influenceScope;
29 |
30 | private String healthUrl;
31 |
32 | private String serviceType;
33 |
34 | private List envUrls;
35 |
36 | private String userWorkNumber;
37 |
38 | private UserDto userDto;
39 |
40 | private Map extensions;
41 |
42 | private String zoneType;
43 |
44 | private Boolean enableHa;
45 | }
46 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/AppDtoPlus.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import com.ppdai.atlas.entity.converter.EnvUrl;
4 | import lombok.Data;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 | /**
10 | * 与 AppDto 相同,返回是多负责人
11 | */
12 | @Data
13 | public class AppDtoPlus extends BaseDto {
14 | private Long id;
15 |
16 | private String appId;
17 |
18 | private String name;
19 |
20 | private Long orgId;
21 |
22 | private OrgDto orgDto;
23 |
24 | private String description;
25 |
26 | private List envUrls;
27 |
28 | private String developers;
29 |
30 | private String tests;
31 |
32 | private List userDtos;
33 |
34 | //主要给前台使用
35 | private List testUserDtos;
36 |
37 | private Map extensions;
38 |
39 | private String zoneType;
40 |
41 | private Boolean enableHa;
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/AppQuotaDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import com.ppdai.atlas.entity.BaseEntity;
4 | import com.ppdai.atlas.entity.converter.MapToStringConverter;
5 | import lombok.Data;
6 |
7 | import javax.persistence.*;
8 | import java.util.Map;
9 |
10 |
11 | @Data
12 | public class AppQuotaDto extends BaseEntity {
13 |
14 | private Long id;
15 |
16 | private String appId;
17 |
18 | private String appName;
19 |
20 | private Long envId;
21 |
22 | private Long orgId;
23 |
24 | private String orgName;
25 |
26 | private String envName;
27 |
28 | private Long spectypeId;
29 |
30 | private String spectypeName;
31 |
32 | private Long number;
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/ApplyDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class ApplyDto {
7 | private Long id;
8 | private String type;
9 | private String status;
10 | private String request;
11 | private String result;
12 | private String applyUser;
13 | private String applyDepartment;
14 | private String opUser;
15 | private Long applyTime;
16 | }
17 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/BaseDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Date;
6 |
7 |
8 | @Data
9 | public class BaseDto {
10 | protected boolean isActive = true;
11 | protected Date insertTime;
12 | protected Date updateTime;
13 | protected String insertBy;
14 | protected String updateBy;
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/DasPage.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import java.util.List;
4 |
5 | public class DasPage {
6 | private long totalElements;
7 | private List elements;
8 |
9 | public long getTotalElements() {
10 | return totalElements;
11 | }
12 |
13 | public void setTotalElements(long totalElements) {
14 | this.totalElements = totalElements;
15 | }
16 |
17 | public List getElements() {
18 | return elements;
19 | }
20 |
21 | public void setElements(List elements) {
22 | this.elements = elements;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/EnvDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Map;
6 |
7 | @Data
8 | public class EnvDto extends BaseDto {
9 |
10 | private Long id;
11 |
12 | private String name;
13 |
14 | private String consul;
15 |
16 | private String nginx;
17 |
18 | private String dns;
19 |
20 | private String dockeryard;
21 |
22 | private String zones;
23 |
24 | private Map extensions;
25 |
26 | private String description;
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/NewAppApplyDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class NewAppApplyDto {
7 | private String appId;
8 | private String appName;
9 | private String department;
10 | private Integer instanceCount;
11 | private String instanceSpec;
12 | private String zoneType;
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/OrgDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Map;
6 |
7 | @Data
8 | public class OrgDto extends BaseDto {
9 |
10 | private Long id;
11 |
12 | private String name;
13 |
14 | private String orgCode;
15 |
16 | private Long parentOrgId;
17 |
18 | //代替 userID
19 | private String userWorkNumber;
20 |
21 | private UserDto userDto;
22 |
23 | private Map extensions;
24 |
25 | private String description;
26 | }
27 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/PageDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.List;
6 |
7 |
8 | @Data
9 | public class PageDto {
10 | private List content;
11 | private long totalElements;
12 | private int totalPages;
13 | private boolean last;
14 | private boolean first;
15 | private int numberOfElements;
16 | private int size;
17 | private int number;
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/QuotaDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Map;
6 |
7 | @Data
8 | public class QuotaDto extends BaseDto {
9 |
10 | private Long id;
11 |
12 | private Long orgId;
13 |
14 | private String orgName;
15 |
16 | private OrgDto orgDto;
17 |
18 | private Long envId;
19 |
20 | private EnvDto envDto;
21 |
22 | private Long specTypeId;
23 |
24 | private SpecTypeDto specTypeDto;
25 |
26 | private Float limit;
27 |
28 | private Float balance;
29 |
30 | private Map extensions;
31 |
32 | private String description;
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/QuotaDtoPlus.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Map;
6 |
7 | @Data
8 | public class QuotaDtoPlus extends BaseDto {
9 |
10 | private Long id;
11 |
12 | private Long orgId;
13 |
14 | private String orgName;
15 |
16 | private OrgDto orgDto;
17 |
18 | private Long envId;
19 |
20 | private EnvDto envDto;
21 |
22 | private Long cpu;
23 |
24 | private Long memory;
25 |
26 | private Long disk;
27 |
28 | private Map extensions;
29 |
30 | private String description;
31 | }
32 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/Response.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 |
6 | @Data
7 | public class Response {
8 | private Integer code;
9 | private String message;
10 | private T detail;
11 |
12 | public static Response success(S t) {
13 | Response response = new Response<>();
14 | response.setCode(0);
15 | response.setMessage("success");
16 | response.setDetail(t);
17 | return response;
18 | }
19 |
20 | public static Response error(String message) {
21 | Response response = new Response<>();
22 | response.setCode(1);
23 | response.setMessage(message);
24 | response.setDetail(null);
25 | return response;
26 | }
27 |
28 | public static Response error(Throwable throwable) {
29 | Response response = new Response<>();
30 | response.setCode(-1);
31 | response.setMessage(throwable.getMessage());
32 | response.setDetail(null);
33 | return response;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/RoleDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Map;
6 |
7 |
8 | @Data
9 | public class RoleDto extends BaseDto {
10 |
11 | private Long id;
12 |
13 | private String name;
14 |
15 | private Map extensions;
16 |
17 | private String description;
18 | }
19 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/SpecTypeDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Map;
6 |
7 |
8 | @Data
9 | public class SpecTypeDto extends BaseDto {
10 |
11 | private Long id;
12 |
13 | private String name;
14 |
15 | private Float cpu;
16 |
17 | private Float memory;
18 |
19 | private Float disk;
20 |
21 | private String description;
22 |
23 | private Map extensions;
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/UpdateApplyStatusDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class UpdateApplyStatusDto {
7 | private Long applyId;
8 | private String opUser;
9 | private String result;
10 | private String status;
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/UserDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Date;
6 | import java.util.List;
7 | import java.util.Map;
8 |
9 |
10 | @Data
11 | public class UserDto extends BaseDto {
12 |
13 | private Long id;
14 |
15 | private String workNumber;
16 |
17 | private String realName;
18 |
19 | private String userName;
20 |
21 | private Long orgId;
22 |
23 | private OrgDto orgDto;
24 |
25 | //store the roles one user belongs to
26 | private List roles;
27 |
28 | private String email;
29 |
30 | private String source;
31 |
32 | protected Date ldapInsertTime;
33 |
34 | protected Date ldapUpdateTime;
35 |
36 | private Map extensions;
37 |
38 | private Date lastVisitAt;
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/UserExtDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class UserExtDto extends BaseDto {
7 |
8 | private Long id;
9 |
10 | private String userWorkNumber;
11 |
12 | private Long orgId;
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/UserRoleDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Map;
6 |
7 |
8 | @Data
9 | public class UserRoleDto extends BaseDto {
10 |
11 | private Long id;
12 |
13 | private String userWorkNumber;
14 |
15 | private Long roleId;
16 |
17 | private String description;
18 |
19 | public Map extensions;
20 | }
21 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/ZoneDto.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Map;
6 |
7 | @Data
8 | public class ZoneDto extends BaseDto {
9 |
10 | private Long id;
11 |
12 | private String name;
13 |
14 | private Long envId;
15 |
16 | private String envName;
17 |
18 | private String k8s;
19 |
20 | private String k8sVersion;
21 |
22 | private Map extensions;
23 |
24 | private String description;
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/query/AppManagerQuery.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto.query;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class AppManagerQuery {
7 | private String appId;
8 | private String developers;
9 | private String testers;
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/query/AppQuery.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto.query;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class AppQuery {
7 | private String appId;
8 |
9 | private String appName;
10 |
11 | private Long orgId;
12 |
13 | private String developers;
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/query/AppQuotaQuery.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto.query;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class AppQuotaQuery {
7 | private String appId;
8 | private Long envId;
9 | }
10 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/query/EnvQuery.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto.query;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class EnvQuery {
7 | private String name;
8 | }
9 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/query/OrgQuery.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto.query;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class OrgQuery {
7 | private String name;
8 | private String userWorkNumber;
9 | }
10 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/query/QuotaQuery.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto.query;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class QuotaQuery {
7 | private String orgName;
8 | private Long envId;
9 | }
10 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/query/QuotaSpectypeCheck.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto.query;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.List;
6 |
7 | @Data
8 | public class QuotaSpectypeCheck {
9 | private List usedSpecItems;
10 | private List applySpecItems;
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/query/RoleQuery.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto.query;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class RoleQuery{
7 | private String name;
8 | }
9 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/query/SpecTypeItem.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto.query;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class SpecTypeItem {
7 | private String specTypeName;
8 | private Integer number;
9 | }
10 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/query/SpecTypeQuery.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto.query;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class SpecTypeQuery {
7 | private String name;
8 | private Float cpu;
9 | private Float memory;
10 | private Float disk;
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/dto/query/UserQuery.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.dto.query;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class UserQuery {
7 | private String realName;
8 | private String userName;
9 | private String orgCode;
10 | }
11 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/AppEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import com.ppdai.atlas.entity.converter.EnvUrl;
4 | import com.ppdai.atlas.entity.converter.ListToJsonStringConverter;
5 | import com.ppdai.atlas.entity.converter.MapToStringConverter;
6 | import lombok.Data;
7 |
8 | import javax.persistence.*;
9 | import java.util.List;
10 | import java.util.Map;
11 |
12 |
13 | @Data
14 | @Entity
15 | @Table(name = "app", schema = "atlas")
16 | public class AppEntity extends BaseEntity {
17 | @Id
18 | @GeneratedValue(strategy = GenerationType.IDENTITY)
19 | @Column(name = "id", nullable = false)
20 | private Long id;
21 |
22 | @Column(name = "appid", nullable = false)
23 | private String appId;
24 |
25 | @Column(name = "name", nullable = false)
26 | private String name;
27 |
28 | @Column(name = "org_id", nullable = false)
29 | private Long orgId;
30 |
31 | @Column(name = "tests")
32 | private String tests;
33 |
34 | @Column(name = "developers")
35 | private String developers;
36 |
37 | @Column(name="env_urls")
38 | @Convert(converter = ListToJsonStringConverter.class)
39 | private List envUrls;
40 |
41 | @Column(name = "extensions")
42 | @Convert(converter = MapToStringConverter.class)
43 | private Map extensions;
44 |
45 | @Column(name = "description")
46 | private String description;
47 |
48 | @Column(name = "zone_type")
49 | private String zoneType;
50 |
51 | @Column(name = "enable_ha", nullable = false, columnDefinition = "TINYINT(1)")
52 | private Boolean enableHa;
53 | }
54 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/AppQuotaEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 |
7 | @Data
8 | @Entity
9 | @Table(name = "app_quota", schema = "atlas")
10 | public class AppQuotaEntity extends BaseEntity {
11 | @Id
12 | @GeneratedValue(strategy = GenerationType.IDENTITY)
13 | @Column(name = "id", nullable = false)
14 | private Long id;
15 |
16 | @Column(name = "appid", nullable = false)
17 | private String appId;
18 |
19 | @Column(name = "app_name")
20 | private String appName;
21 |
22 | @Column(name = "org_id", nullable = false)
23 | private Long orgId;
24 |
25 | @Column(name = "env_id", nullable = false)
26 | private Long envId;
27 |
28 | @Column(name = "spectype_id", nullable = false)
29 | private Long spectypeId;
30 |
31 | @Column(name = "number", nullable = false)
32 | private Long number;
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/ApplyEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.Date;
7 |
8 | @Entity
9 | @Data
10 | @Table(name = "apply", catalog = "")
11 | public class ApplyEntity extends BaseEntity {
12 |
13 | @Id
14 | @GeneratedValue(strategy = GenerationType.IDENTITY)
15 | private Long id;
16 |
17 | @Basic
18 | @Column(name = "type", nullable = false, length = 128)
19 | private String type;
20 |
21 | @Basic
22 | @Column(name = "status", nullable = false, length = 128)
23 | private String status;
24 |
25 | @Basic
26 | @Column(name = "request", nullable = true)
27 | private String request;
28 |
29 | @Basic
30 | @Column(name = "result", nullable = true)
31 | private String result;
32 |
33 | @Basic
34 | @Column(name = "apply_user", nullable = false, length = 64)
35 | private String applyUser;
36 |
37 | @Basic
38 | @Column(name = "apply_department", nullable = false, length = 64)
39 | private String applyDepartment;
40 |
41 | @Basic
42 | @Column(name = "op_user", nullable = false, length = 64)
43 | private String opUser;
44 |
45 | @Temporal(TemporalType.TIMESTAMP)
46 | @Column(name = "apply_time")
47 | public Date applyTime;
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/AuditLogEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 | import java.util.Date;
7 |
8 | @Data
9 | @Entity
10 | @Table(name = "audit_log", schema = "atlas")
11 | public class AuditLogEntity {
12 |
13 | @Id
14 | @GeneratedValue(strategy = GenerationType.IDENTITY)
15 | @Column(name = "id", nullable = false)
16 | private Long id;
17 |
18 | @Column(name = "user_name", nullable = true, length = 32)
19 | private String userName;
20 |
21 | @Column(name = "client_ip", nullable = true, length = 32)
22 | private String clientIp;
23 |
24 | @Column(name = "http_method", nullable = true, length = 64)
25 | private String httpMethod;
26 |
27 | @Column(name = "http_uri", nullable = true, length = 256)
28 | private String httpUri;
29 |
30 | @Column(name = "class_method", nullable = true, length = 128)
31 | private String classMethod;
32 |
33 | @Column(name = "class_method_args", nullable = true, length = 256)
34 | private String classMethodArgs;
35 |
36 | @Column(name = "class_method_return", nullable = true, length = 1024)
37 | private String classMethodReturn;
38 |
39 | @Temporal(TemporalType.TIMESTAMP)
40 | @Column(name = "insert_time",insertable = false, updatable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
41 | protected Date insertTime;
42 |
43 | @Temporal(TemporalType.TIMESTAMP)
44 | @Column(name = "update_time", insertable = false, updatable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
45 | protected Date updateTime;
46 |
47 | @Column(name = "is_active", nullable = false, columnDefinition = "TINYINT(1)")
48 | protected Boolean isActive = true;
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/BaseEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import lombok.Data;
4 | import org.springframework.data.annotation.CreatedBy;
5 | import org.springframework.data.annotation.LastModifiedBy;
6 | import org.springframework.data.jpa.domain.support.AuditingEntityListener;
7 |
8 | import javax.persistence.*;
9 | import java.io.Serializable;
10 | import java.util.Date;
11 |
12 | @Data
13 | @EntityListeners(AuditingEntityListener.class)
14 | @MappedSuperclass
15 | public class BaseEntity implements Serializable {
16 |
17 | @Temporal(TemporalType.TIMESTAMP)
18 | @Column(name = "insert_time", insertable = false, updatable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
19 | protected Date insertTime;
20 |
21 | @Temporal(TemporalType.TIMESTAMP)
22 | @Column(name = "update_time", insertable = false, updatable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
23 | protected Date updateTime;
24 |
25 | @CreatedBy
26 | @Column(name = "insert_by", length = 45)
27 | protected String insertBy;
28 |
29 | @LastModifiedBy
30 | @Column(name = "update_by", length = 45)
31 | protected String updateBy;
32 |
33 | @Column(name = "isactive", nullable = false, columnDefinition = "TINYINT(1)")
34 | protected boolean isActive = true;
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/EnvEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import com.ppdai.atlas.entity.converter.MapToStringConverter;
4 | import lombok.Data;
5 |
6 | import javax.persistence.*;
7 | import java.util.Map;
8 |
9 | @Data
10 | @Entity
11 | @Table(name = "env", schema = "atlas")
12 | public class EnvEntity extends BaseEntity{
13 | @Id
14 | @GeneratedValue(strategy = GenerationType.IDENTITY)
15 | @Column(name = "id", nullable = false)
16 | private Long id;
17 |
18 | @Column(name = "name", nullable = false)
19 | private String name;
20 |
21 | @Column(name = "consul", nullable = false)
22 | private String consul;
23 |
24 | @Column(name = "nginx")
25 | private String nginx;
26 |
27 | @Column(name = "dns")
28 | private String dns;
29 |
30 | @Column(name = "dockeryard")
31 | private String dockeryard;
32 |
33 | @Column(name = "extensions")
34 | @Convert(converter = MapToStringConverter.class)
35 | public Map extensions;
36 |
37 | @Column(name = "description")
38 | private String description;
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/LockEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 |
7 | @Data
8 | @Entity
9 | @Table(name = "locks", schema = "atlas")
10 | public class LockEntity extends BaseEntity {
11 | @Id
12 | @GeneratedValue(strategy = GenerationType.IDENTITY)
13 | @Column(name = "id", nullable = false)
14 | private Long id;
15 |
16 | @Column(name = "name", nullable = false)
17 | private String name;
18 |
19 | @Column(name = "version", nullable = false)
20 | private Long version;
21 |
22 | @Column(name = "possessor")
23 | private String possessor;
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/OrgEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import com.ppdai.atlas.entity.converter.MapToStringConverter;
4 | import lombok.Data;
5 |
6 | import javax.persistence.*;
7 | import java.util.Map;
8 |
9 | @Data
10 | @Entity
11 | @Table(name = "org", schema = "atlas")
12 | public class OrgEntity extends BaseEntity {
13 | @Id
14 | @GeneratedValue(strategy = GenerationType.IDENTITY)
15 | @Column(name = "id", nullable = false)
16 | private Long id;
17 |
18 | @Column(name = "name", nullable = false)
19 | private String name;
20 |
21 | @Column(name = "org_code", nullable = false)
22 | private String orgCode;
23 |
24 | @Column(name = "parent_org_id", nullable = false)
25 | private Long parentOrgId;
26 |
27 | @Column(name = "user_work_number")
28 | private String userWorkNumber;
29 |
30 | @Column(name = "extensions")
31 | @Convert(converter = MapToStringConverter.class)
32 | public Map extensions;
33 |
34 | @Column(name = "description")
35 | private String description;
36 | }
37 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/QuotaEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import com.ppdai.atlas.entity.converter.MapToStringConverter;
4 | import lombok.Data;
5 |
6 | import javax.persistence.*;
7 | import java.util.Map;
8 |
9 | @Data
10 | @Entity
11 | @Table(name = "quota", schema = "atlas")
12 | public class QuotaEntity extends BaseEntity {
13 | @Id
14 | @GeneratedValue(strategy = GenerationType.IDENTITY)
15 | @Column(name = "id", nullable = false)
16 | private Long id;
17 |
18 | @Column(name = "org_id", nullable = false)
19 | private Long orgId;
20 |
21 | @Column(name = "org_name", nullable = false)
22 | private String orgName;
23 |
24 | @Column(name = "env_id", nullable = false)
25 | private Long envId;
26 |
27 | @Column(name = "cpu", nullable = false)
28 | private Long cpu;
29 |
30 | @Column(name = "memory", nullable = false)
31 | private Long memory;
32 |
33 | @Column(name = "disk", nullable = false)
34 | private Long disk;
35 |
36 | @Column(name = "extensions")
37 | @Convert(converter = MapToStringConverter.class)
38 | public Map extensions;
39 |
40 | @Column(name = "description")
41 | private String description;
42 | }
43 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/RoleEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import com.ppdai.atlas.entity.converter.MapToStringConverter;
4 | import lombok.Data;
5 |
6 | import javax.persistence.*;
7 | import java.util.Map;
8 |
9 | @Data
10 | @Entity
11 | @Table(name = "role", schema = "atlas")
12 | public class RoleEntity extends BaseEntity{
13 | @Id
14 | @GeneratedValue(strategy = GenerationType.IDENTITY)
15 | @Column(name = "id", nullable = false)
16 | private Long id;
17 |
18 | @Column(name = "name", nullable = false)
19 | private String name;
20 |
21 | @Column(name = "extensions")
22 | @Convert(converter = MapToStringConverter.class)
23 | public Map extensions;
24 |
25 | @Column(name = "description")
26 | private String description;
27 | }
28 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/SpecTypeEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import com.ppdai.atlas.entity.converter.MapToStringConverter;
4 | import lombok.Data;
5 |
6 | import javax.persistence.*;
7 | import java.util.Map;
8 |
9 | @Data
10 | @Entity
11 | @Table(name = "spec_type", schema = "atlas")
12 | public class SpecTypeEntity extends BaseEntity {
13 | @Id
14 | @GeneratedValue(strategy = GenerationType.IDENTITY)
15 | @Column(name = "id", nullable = false)
16 | private Long id;
17 |
18 | @Column(name = "name")
19 | private String name;
20 |
21 | @Column(name = "cpu", nullable = false)
22 | private Float cpu;
23 |
24 | @Column(name = "memory", nullable = false)
25 | private Float memory;
26 |
27 | @Column(name = "disk", nullable = false)
28 | private Float disk;
29 |
30 | @Column(name = "extensions")
31 | @Convert(converter = MapToStringConverter.class)
32 | public Map extensions;
33 |
34 | @Column(name = "description")
35 | private String description;
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/UserEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import com.ppdai.atlas.entity.converter.MapToStringConverter;
4 | import lombok.Data;
5 |
6 | import javax.persistence.*;
7 | import java.util.Date;
8 | import java.util.Map;
9 |
10 | @Data
11 | @Entity
12 | @Table(name = "user_info", schema = "atlas")
13 | public class UserEntity extends BaseEntity {
14 |
15 | @Id
16 | @GeneratedValue(strategy = GenerationType.IDENTITY)
17 | @Column(name = "id", nullable = false)
18 | private Long id;
19 |
20 | @Column(name = "work_number")
21 | private String workNumber;
22 |
23 | @Column(name = "real_name", nullable = false, length = 45)
24 | private String realName;
25 |
26 | @Column(name = "user_name", nullable = false, length = 45)
27 | private String userName;
28 |
29 | @Column(name = "email")
30 | private String email;
31 |
32 | @Column(name = "source")
33 | private String source;
34 |
35 | @Temporal(TemporalType.TIMESTAMP)
36 | @Column(name = "ldap_insert_time")
37 | protected Date ldapInsertTime;
38 |
39 | @Temporal(TemporalType.TIMESTAMP)
40 | @Column(name = "ldap_update_time")
41 | protected Date ldapUpdateTime;
42 |
43 | @Column(name = "extensions")
44 | @Convert(converter = MapToStringConverter.class)
45 | public Map extensions;
46 |
47 | @Temporal(TemporalType.TIMESTAMP)
48 | @Column(name = "last_visit_at", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
49 | private Date lastVisitAt;
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/UserExtEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import lombok.Data;
4 |
5 | import javax.persistence.*;
6 |
7 | @Data
8 | @Entity
9 | @Table(name = "user_ext", schema = "atlas")
10 | public class UserExtEntity extends BaseEntity {
11 |
12 | @Id
13 | @GeneratedValue(strategy = GenerationType.IDENTITY)
14 | @Column(name = "id", nullable = false)
15 | private Long id;
16 |
17 | @OneToOne(cascade = CascadeType.PERSIST)
18 | @JoinColumn(name = "user_work_number", referencedColumnName = "work_number")
19 | public UserEntity userEntity;
20 |
21 | @Column(name = "orgId", nullable = false)
22 | private Long orgId;
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/UserRoleEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import com.ppdai.atlas.entity.converter.MapToStringConverter;
4 | import lombok.Data;
5 |
6 | import javax.persistence.*;
7 | import java.util.Map;
8 |
9 | @Data
10 | @Entity
11 | @Table(name = "user_role", schema = "atlas")
12 | public class UserRoleEntity extends BaseEntity {
13 | @Id
14 | @GeneratedValue(strategy = GenerationType.IDENTITY)
15 | @Column(name = "id", nullable = false)
16 | private Long id;
17 |
18 | @Column(name = "user_work_number", nullable = false)
19 | private String userWorkNumber;
20 |
21 | @Column(name = "role_id", nullable = false)
22 | private Long roleId;
23 |
24 | @Column(name = "extensions")
25 | @Convert(converter = MapToStringConverter.class)
26 | public Map extensions;
27 |
28 | @Column(name = "description")
29 | private String description;
30 | }
31 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/ZoneEntity.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity;
2 |
3 | import com.ppdai.atlas.entity.converter.MapToStringConverter;
4 | import lombok.Data;
5 |
6 | import javax.persistence.*;
7 | import java.util.Map;
8 |
9 | @Data
10 | @Entity
11 | @Table(name = "zone", schema = "atlas")
12 | public class ZoneEntity extends BaseEntity {
13 |
14 | @Id
15 | @GeneratedValue(strategy = GenerationType.IDENTITY)
16 | @Column(name = "id", nullable = false)
17 | private Long id;
18 |
19 | @Column(name = "name", nullable = false)
20 | private String name;
21 |
22 | @Column(name = "env_id", nullable = false)
23 | private Long envId;
24 |
25 | @Column(name = "env_name", nullable = false)
26 | private String envName;
27 |
28 | @Column(name = "k8s", nullable = false)
29 | private String k8s;
30 |
31 | @Column(name = "k8s_version", nullable = false)
32 | private String k8sVersion;
33 |
34 | @Column(name = "description")
35 | private String description;
36 |
37 | @Column(name = "extensions")
38 | @Convert(converter = MapToStringConverter.class)
39 | private Map extensions;
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/converter/EnvUrl.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity.converter;
2 |
3 | import lombok.Data;
4 |
5 | @Data
6 | public class EnvUrl {
7 | private String envName;
8 | private String url;
9 | }
10 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/converter/ListToJsonStringConverter.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity.converter;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.google.common.collect.Lists;
5 | import lombok.extern.slf4j.Slf4j;
6 |
7 | import javax.persistence.AttributeConverter;
8 | import javax.persistence.Converter;
9 | import java.util.List;
10 |
11 |
12 | @Slf4j
13 | @Converter(autoApply = true)
14 | public class ListToJsonStringConverter implements AttributeConverter, String> {
15 |
16 |
17 | @Override
18 | public String convertToDatabaseColumn(List listUrls) {
19 | try {
20 | return JSON.toJSONString(listUrls);
21 | } catch (Exception e) {
22 | log.info("transforming list to JSON string error:{}", e.getMessage());
23 | return null;
24 | }
25 | }
26 |
27 | @Override
28 | public List convertToEntityAttribute(String dbData) {
29 |
30 | try {
31 | return JSON.parseObject(dbData, List.class);
32 | } catch (Exception e) {
33 | log.info("transforming JSON string to List error: {}", e.getMessage());
34 | return Lists.newArrayList();
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/main/java/com/ppdai/atlas/entity/converter/MapToStringConverter.java:
--------------------------------------------------------------------------------
1 | package com.ppdai.atlas.entity.converter;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import com.google.common.collect.Maps;
5 | import lombok.extern.slf4j.Slf4j;
6 |
7 | import javax.persistence.AttributeConverter;
8 | import javax.persistence.Converter;
9 | import java.util.Map;
10 |
11 |
12 | @Slf4j
13 | @Converter(autoApply = true)
14 | public class MapToStringConverter implements AttributeConverter