diff --git a/core/core-backend/src/main/java/io/dataease/license/server/LicenseServer.java b/core/core-backend/src/main/java/io/dataease/license/server/LicenseServer.java
index 69978d0abe..96cfded318 100644
--- a/core/core-backend/src/main/java/io/dataease/license/server/LicenseServer.java
+++ b/core/core-backend/src/main/java/io/dataease/license/server/LicenseServer.java
@@ -2,10 +2,14 @@ package io.dataease.license.server;
import io.dataease.api.license.LicenseApi;
import io.dataease.api.license.dto.LicenseRequest;
+import io.dataease.exception.DEException;
import io.dataease.license.bo.F2CLicResult;
import io.dataease.license.manage.CoreLicManage;
import io.dataease.license.manage.F2CLicManage;
+import io.dataease.license.utils.LicenseUtil;
+import io.dataease.utils.AuthUtils;
import jakarta.annotation.Resource;
+import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@@ -39,4 +43,13 @@ public class LicenseServer implements LicenseApi {
public String version() {
return coreLicManage.getVersion();
}
+
+ @Override
+ public void revert() {
+ F2CLicResult f2CLicResult = null;
+ if (!AuthUtils.isSysAdmin() || ObjectUtils.isEmpty(f2CLicResult = LicenseUtil.get()) || f2CLicResult.getStatus() != F2CLicResult.Status.expired) {
+ DEException.throwException("不能进行还原操作!");
+ }
+ f2CLicManage.revert();
+ }
}
diff --git a/core/core-frontend/src/api/about.ts b/core/core-frontend/src/api/about.ts
index 1a20032bb7..fb3e7efab5 100644
--- a/core/core-frontend/src/api/about.ts
+++ b/core/core-frontend/src/api/about.ts
@@ -3,3 +3,4 @@ import request from '@/config/axios'
export const validateApi = data => request.post({ url: '/license/validate', data })
export const buildVersionApi = () => request.get({ url: '/license/version' })
export const updateInfoApi = data => request.post({ url: '/license/update', data })
+export const revertApi = () => request.post({ url: '/license/revert' })
diff --git a/core/core-frontend/src/locales/en.ts b/core/core-frontend/src/locales/en.ts
index eec3c86cb8..2a49c23c58 100644
--- a/core/core-frontend/src/locales/en.ts
+++ b/core/core-frontend/src/locales/en.ts
@@ -2461,7 +2461,9 @@ export default {
support: 'Get technical support',
update_success: 'Update successful',
serial_no: 'Serial number',
- remark: 'Remark'
+ remark: 'Remark',
+ back_community: 'Revert to Community Edition',
+ confirm_tips: 'Are you sure you want to restore to the community edition? '
},
cron: {
second: 'Seconds',
diff --git a/core/core-frontend/src/locales/tw.ts b/core/core-frontend/src/locales/tw.ts
index ed5619553a..2af5713f30 100644
--- a/core/core-frontend/src/locales/tw.ts
+++ b/core/core-frontend/src/locales/tw.ts
@@ -2392,7 +2392,9 @@ export default {
support: '取得技術支援',
update_success: '更新成功',
serial_no: '序號',
- remark: '備註'
+ remark: '備註',
+ back_community: '還原至社區版',
+ confirm_tips: '确定還原至社區版?'
},
cron: {
second: '秒',
diff --git a/core/core-frontend/src/locales/zh-CN.ts b/core/core-frontend/src/locales/zh-CN.ts
index 4a96043d70..21f579e244 100644
--- a/core/core-frontend/src/locales/zh-CN.ts
+++ b/core/core-frontend/src/locales/zh-CN.ts
@@ -2398,7 +2398,9 @@ export default {
support: '获取技术支持',
update_success: '更新成功',
serial_no: '序列号',
- remark: '备注'
+ remark: '备注',
+ back_community: '还原至社区版',
+ confirm_tips: '确定还原至社区版?'
},
cron: {
second: '秒',
diff --git a/core/core-frontend/src/views/about/index.vue b/core/core-frontend/src/views/about/index.vue
index af8e2e52b8..6b3327509b 100644
--- a/core/core-frontend/src/views/about/index.vue
+++ b/core/core-frontend/src/views/about/index.vue
@@ -4,8 +4,8 @@ import aboutBg from '@/assets/img/about-bg.png'
import { ref, reactive, onMounted } from 'vue'
import { useUserStoreWithOut } from '@/store/modules/user'
import { F2CLicense } from './index'
-import { validateApi, buildVersionApi, updateInfoApi } from '@/api/about'
-import { ElMessage } from 'element-plus-secondary'
+import { validateApi, buildVersionApi, updateInfoApi, revertApi } from '@/api/about'
+import { ElMessage, ElMessageBox } from 'element-plus-secondary'
import { useI18n } from '@/hooks/web/useI18n'
import { useEmitt } from '@/hooks/web/useEmitt'
import { useCache } from '@/hooks/web/useCache'
@@ -58,7 +58,25 @@ const support = () => {
const openType = wsCache.get('open-backend') === '1' ? '_self' : '_blank'
window.open(url, openType)
}
-
+const back2Community = () => {
+ ElMessageBox.confirm(t('about.confirm_tips'), {
+ confirmButtonType: 'danger',
+ type: 'warning',
+ confirmButtonText: t('common.sure'),
+ cancelButtonText: t('dataset.cancel'),
+ autofocus: false,
+ showClose: false
+ })
+ .then(() => {
+ revertApi().then(() => {
+ ElMessage.success(t('about.update_success'))
+ window.location.reload()
+ })
+ })
+ .catch(e => {
+ console.error(e)
+ })
+}
const getLicenseInfo = () => {
validateHandler({}, res => {
const info = getLicense(res.data)
@@ -203,6 +221,9 @@ const update = (licKey: string) => {
{{ $t('about.update_license') }}
{{ $t('about.support') }}
+
+ {{ $t('about.back_community') }}
+
diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/license/LicenseApi.java b/sdk/api/api-base/src/main/java/io/dataease/api/license/LicenseApi.java
index cd6402beed..52fa85ef7a 100644
--- a/sdk/api/api-base/src/main/java/io/dataease/api/license/LicenseApi.java
+++ b/sdk/api/api-base/src/main/java/io/dataease/api/license/LicenseApi.java
@@ -17,4 +17,7 @@ public interface LicenseApi {
@GetMapping("/version")
String version();
+
+ @PostMapping("/revert")
+ void revert();
}
diff --git a/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/auth/api/InteractiveAuthApi.java b/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/auth/api/InteractiveAuthApi.java
index bfc9779587..1022dff379 100644
--- a/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/auth/api/InteractiveAuthApi.java
+++ b/sdk/api/api-permissions/src/main/java/io/dataease/api/permissions/auth/api/InteractiveAuthApi.java
@@ -89,4 +89,8 @@ public interface InteractiveAuthApi {
@PostMapping("/batchAuthorize")
void batchAuthorize(@RequestBody BusiBatchAuthorizeRequest request);
+
+ @Hidden
+ @PostMapping("/revert")
+ void revert();
}