diff --git a/src/main/java/neatlogic/module/tenant/api/auth/AuthModuleGetApi.java b/src/main/java/neatlogic/module/tenant/api/auth/AuthModuleGetApi.java index f22537eb1ddb3ff333c12d149f1d85301864d60a..ade73edabf7efdb6f8da96e8cb28336032a5b052 100644 --- a/src/main/java/neatlogic/module/tenant/api/auth/AuthModuleGetApi.java +++ b/src/main/java/neatlogic/module/tenant/api/auth/AuthModuleGetApi.java @@ -132,13 +132,12 @@ public class AuthModuleGetApi extends PrivateApiComponentBase { if (CollectionUtils.isNotEmpty(homePageIdList)) { HomePageVo homePage = homePageMapper.getMinSortHomePageByIdList(homePageIdList); if (homePage != null) { - userDataVo = new UserDataVo(UserContext.get().getUserUuid(), homePage.getConfigStr(), "defaultModulePage"); + userDataVo = new UserDataVo(UserContext.get().getUserUuid(), homePage.getConfig(), "defaultModulePage"); } } } if (userDataVo != null) { - String data = userDataVo.getData(); - JSONObject dataJson = JSONObject.parseObject(data); + JSONObject dataJson = userDataVo.getData(); JSONArray defaultModulePageList = dataJson.getJSONArray("defaultModulePageList"); for (int i = 0; i < defaultModulePageList.size(); i++) { JSONObject o = defaultModulePageList.getJSONObject(i); diff --git a/src/main/java/neatlogic/module/tenant/api/user/DeleteUserDataApi.java b/src/main/java/neatlogic/module/tenant/api/user/DeleteUserDataApi.java new file mode 100644 index 0000000000000000000000000000000000000000..56179cf4725042699c7f24667536151de1805441 --- /dev/null +++ b/src/main/java/neatlogic/module/tenant/api/user/DeleteUserDataApi.java @@ -0,0 +1,63 @@ +/*Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .*/ + +package neatlogic.module.tenant.api.user; + +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.asynchronization.threadlocal.UserContext; +import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.dao.mapper.UserMapper; +import neatlogic.framework.restful.annotation.*; +import neatlogic.framework.restful.constvalue.OperationTypeEnum; +import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service + +@OperationType(type = OperationTypeEnum.DELETE) +public class DeleteUserDataApi extends PrivateApiComponentBase { + + @Autowired + UserMapper userMapper; + + + @Override + public String getToken() { + return "user/data/delete"; + } + + @Override + public String getName() { + return "nmtau.deleteuserdataapi.getname"; + } + + @Override + public String getConfig() { + return null; + } + + @Input({ + @Param(name = "type", type = ApiParamType.STRING, isRequired = true, desc = "common.type", help = "如果是用户默认模块数据,则应指定为defaultModulePage") + }) + @Output({}) + @Description(desc = "nmtau.deleteuserdataapi.getname") + @Override + public Object myDoService(JSONObject jsonObj) throws Exception { + String type = jsonObj.getString("type"); + userMapper.deleteUserDataByUserUuidAndType(UserContext.get().getUserUuid(true), type); + return null; + } +} diff --git a/src/main/java/neatlogic/module/tenant/api/user/GetUserDataApi.java b/src/main/java/neatlogic/module/tenant/api/user/GetUserDataApi.java new file mode 100644 index 0000000000000000000000000000000000000000..605a757e39df029b78491703376b89bed90cc895 --- /dev/null +++ b/src/main/java/neatlogic/module/tenant/api/user/GetUserDataApi.java @@ -0,0 +1,65 @@ +/*Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .*/ + +package neatlogic.module.tenant.api.user; + +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.asynchronization.threadlocal.UserContext; +import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.dao.mapper.UserMapper; +import neatlogic.framework.dto.UserDataVo; +import neatlogic.framework.restful.annotation.*; +import neatlogic.framework.restful.constvalue.OperationTypeEnum; +import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service + +@OperationType(type = OperationTypeEnum.SEARCH) +public class GetUserDataApi extends PrivateApiComponentBase { + + @Autowired + UserMapper userMapper; + + @Override + public String getToken() { + return "user/data/get"; + } + + @Override + public String getName() { + return "nmtau.getuserdataapi.getname"; + } + + @Override + public String getConfig() { + return null; + } + + @Input({ + @Param(name = "type", type = ApiParamType.STRING, isRequired = true, desc = "common.type", help = "如果是用户默认模块数据,则应指定为defaultModulePage") + }) + @Output({ + @Param(explode = UserDataVo.class) + }) + @Description(desc = "nmtau.getuserdataapi.getname") + @Override + public Object myDoService(JSONObject jsonObj) throws Exception { + String userUuid = UserContext.get().getUserUuid(true); + String type = jsonObj.getString("type"); + return userMapper.getUserDataByUserUuidAndType(userUuid, type); + } +} diff --git a/src/main/java/neatlogic/module/tenant/api/user/UserDataSaveApi.java b/src/main/java/neatlogic/module/tenant/api/user/UserDataSaveApi.java index a2c17eccdbe540b2ee7873a7fc4fc3aec641395e..5c41cdb2eea5c7a63de733f55148ecc5a08e6499 100644 --- a/src/main/java/neatlogic/module/tenant/api/user/UserDataSaveApi.java +++ b/src/main/java/neatlogic/module/tenant/api/user/UserDataSaveApi.java @@ -15,15 +15,14 @@ along with this program. If not, see .*/ package neatlogic.module.tenant.api.user; +import com.alibaba.fastjson.JSONObject; import neatlogic.framework.asynchronization.threadlocal.UserContext; -import neatlogic.framework.auth.core.AuthAction; import neatlogic.framework.common.constvalue.ApiParamType; import neatlogic.framework.dao.mapper.UserMapper; import neatlogic.framework.dto.UserDataVo; import neatlogic.framework.restful.annotation.*; import neatlogic.framework.restful.constvalue.OperationTypeEnum; import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; -import com.alibaba.fastjson.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -43,7 +42,7 @@ public class UserDataSaveApi extends PrivateApiComponentBase { @Override public String getName() { - return "保存用户数据"; + return "nmtau.userdatasaveapi.getname"; } @Override @@ -51,18 +50,18 @@ public class UserDataSaveApi extends PrivateApiComponentBase { return null; } - @Input({@Param(name = "type", type = ApiParamType.STRING, desc = "功能类型,如果是用户默认模块数据,则应指定为defaultModulePage", - isRequired = true) + @Input({ + @Param(name = "type", type = ApiParamType.STRING, isRequired = true, desc = "common.type", help = "如果是用户默认模块数据,则应指定为defaultModulePage") }) @Output({}) - @Description(desc = "保存用户数据") + @Description(desc = "nmtau.userdatasaveapi.getname") @Override public Object myDoService(JSONObject jsonObj) throws Exception { UserDataVo userDataVo = new UserDataVo(); String userUuid = UserContext.get().getUserUuid(true); String type = jsonObj.getString("type"); userDataVo.setUserUuid(userUuid); - userDataVo.setData(jsonObj.toJSONString()); + userDataVo.setData(jsonObj); userDataVo.setType(type); if(userMapper.getUserDataByUserUuidAndType(userUuid,type) == null){