From 1cf60106834674ae137323087b27f7fd2dd978fb Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Wed, 28 Jun 2023 17:19:17 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=907.6.0=E3=80=91=E3=80=90config=E3=80=91?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E7=9A=84=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E5=AD=97=E5=85=B8=E7=9B=B8=E5=85=B3=E7=9A=84?= =?UTF-8?q?api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel-d-config/config-business/pom.xml | 8 ++ .../controller/SysConfigTypeController.java | 82 +++++++++++++++++++ .../pojo/param/SysConfigTypeParam.java | 73 +++++++++++++++++ .../modular/service/SysConfigTypeService.java | 48 +++++++++++ .../controller/UserTranslationController.java | 5 +- .../roses/kernel/dict/api/DictApi.java | 3 +- .../modular/service/impl/DictServiceImpl.java | 3 +- .../impl/HrOrgApproverServiceImpl.java | 8 +- 8 files changed, 223 insertions(+), 7 deletions(-) create mode 100644 kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/controller/SysConfigTypeController.java create mode 100644 kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/pojo/param/SysConfigTypeParam.java create mode 100644 kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/service/SysConfigTypeService.java diff --git a/kernel-d-config/config-business/pom.xml b/kernel-d-config/config-business/pom.xml index 7f1adeb5b..6ba78299f 100644 --- a/kernel-d-config/config-business/pom.xml +++ b/kernel-d-config/config-business/pom.xml @@ -17,6 +17,14 @@ + + + + cn.stylefeng.roses + dict-api + ${roses.version} + + diff --git a/kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/controller/SysConfigTypeController.java b/kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/controller/SysConfigTypeController.java new file mode 100644 index 000000000..e2144a0f2 --- /dev/null +++ b/kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/controller/SysConfigTypeController.java @@ -0,0 +1,82 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.config.modular.controller; + +import cn.stylefeng.roses.kernel.config.modular.pojo.param.SysConfigTypeParam; +import cn.stylefeng.roses.kernel.config.modular.service.SysConfigTypeService; +import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict; +import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData; +import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData; +import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource; +import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource; +import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 配置分类的控制器 + *

+ * 配置分类其实是对应的字典,字典类型编码是config_group + * + * @author fengshuonan + * @since 2023/6/28 16:46 + */ +@RestController +@ApiResource(name = "配置分类的接口") +public class SysConfigTypeController { + + @Resource + private SysConfigTypeService sysConfigTypeService; + + /** + * 查看系统配置分类列表 + * + * @author fengshuonan + * @since 2023/6/28 16:51 + */ + @GetResource(name = "查看系统配置分类列表", path = "/sysConfigType/list") + public ResponseData> sysConfigTypeList(SysConfigTypeParam sysConfigTypeParam) { + return new SuccessResponseData<>(sysConfigTypeService.getSysConfigTypeList(sysConfigTypeParam)); + } + + /** + * 新增配置类型 + * + * @author fengshuonan + * @since 2023/6/28 17:00 + */ + @PostResource(name = "新增配置类型", path = "/sysConfigType/add") + public ResponseData add(@RequestBody @Validated(SysConfigTypeParam.add.class) SysConfigTypeParam sysConfigTypeParam) { + sysConfigTypeService.add(sysConfigTypeParam); + return new SuccessResponseData<>(); + } + +} + + diff --git a/kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/pojo/param/SysConfigTypeParam.java b/kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/pojo/param/SysConfigTypeParam.java new file mode 100644 index 000000000..707ad2da9 --- /dev/null +++ b/kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/pojo/param/SysConfigTypeParam.java @@ -0,0 +1,73 @@ +/* + * Copyright [2020-2030] [https://www.stylefeng.cn] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Guns源码头部的版权声明。 + * 3.请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns + * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns + * 6.若您的项目无法满足以上几点,可申请商业授权 + */ +package cn.stylefeng.roses.kernel.config.modular.pojo.param; + +import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription; +import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import javax.validation.constraints.NotBlank; +import java.math.BigDecimal; + +/** + * 系统配置类型请求参数 + * + * @author fengshuonan + * @since 2023/6/28 17:02 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class SysConfigTypeParam extends BaseRequest { + + /** + * 配置类型id + */ + @NotBlank(message = "配置类型id不能为空", groups = {edit.class, detail.class}) + @ChineseDescription("配置类型id") + private Long configTypeId; + + /** + * 配置类型名称 + */ + @NotBlank(message = "配置类型名称不能为空", groups = {add.class, edit.class}) + @ChineseDescription("配置类型名称") + private String configTypeName; + + /** + * 配置类型编码 + */ + @NotBlank(message = "配置类型编码不能为空", groups = {add.class, edit.class}) + @ChineseDescription("配置类型编码") + private String configTypeCode; + + /** + * 配置类型顺序 + */ + @NotBlank(message = "配置类型顺序不能为空", groups = {add.class, edit.class}) + @ChineseDescription("配置类型顺序") + private BigDecimal configTypeSort; + +} diff --git a/kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/service/SysConfigTypeService.java b/kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/service/SysConfigTypeService.java new file mode 100644 index 000000000..435206368 --- /dev/null +++ b/kernel-d-config/config-business/src/main/java/cn/stylefeng/roses/kernel/config/modular/service/SysConfigTypeService.java @@ -0,0 +1,48 @@ +package cn.stylefeng.roses.kernel.config.modular.service; + +import cn.stylefeng.roses.kernel.config.api.constants.ConfigConstants; +import cn.stylefeng.roses.kernel.config.modular.pojo.param.SysConfigTypeParam; +import cn.stylefeng.roses.kernel.dict.api.DictApi; +import cn.stylefeng.roses.kernel.rule.pojo.dict.SimpleDict; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 配置类型业务 + * + * @author fengshuonan + * @since 2023/6/28 16:52 + */ +@Service +public class SysConfigTypeService { + + @Resource + private DictApi dictApi; + + /** + * 查询系统配置类型列表 + *

+ * 查询字典类型为config_group的所有字典列表 + * + * @author fengshuonan + * @since 2023/6/28 16:56 + */ + public List getSysConfigTypeList(SysConfigTypeParam sysConfigTypeParam) { + return dictApi.getDictDetailsByDictTypeCode(ConfigConstants.CONFIG_GROUP_DICT_TYPE_CODE, sysConfigTypeParam.getSearchText()); + } + + /** + * 新增系统配置类型 + *

+ * 针对字典类型编码为config_group的字典增加一个条目 + * + * @author fengshuonan + * @since 2023/6/28 17:07 + */ + public void add(SysConfigTypeParam sysConfigTypeParam) { + + } + +} diff --git a/kernel-d-i18n/i18n-business/src/main/java/cn/stylefeng/roses/kernel/i18n/modular/controller/UserTranslationController.java b/kernel-d-i18n/i18n-business/src/main/java/cn/stylefeng/roses/kernel/i18n/modular/controller/UserTranslationController.java index bcc69bbd6..57d1e0c0a 100644 --- a/kernel-d-i18n/i18n-business/src/main/java/cn/stylefeng/roses/kernel/i18n/modular/controller/UserTranslationController.java +++ b/kernel-d-i18n/i18n-business/src/main/java/cn/stylefeng/roses/kernel/i18n/modular/controller/UserTranslationController.java @@ -70,7 +70,7 @@ public class UserTranslationController { */ @GetResource(name = "获取所有的多语言类型编码", path = "/i18n/getAllLanguages", requiredPermission = false) public ResponseData> getAllLanguages() { - List dictDetailsByDictTypeCode = dictApi.getDictDetailsByDictTypeCode(I18nConstants.LANGUAGES_DICT_TYPE_CODE); + List dictDetailsByDictTypeCode = dictApi.getDictDetailsByDictTypeCode(I18nConstants.LANGUAGES_DICT_TYPE_CODE, null); return new SuccessResponseData<>(dictDetailsByDictTypeCode); } @@ -94,7 +94,8 @@ public class UserTranslationController { * @since 2021/1/27 22:04 */ @PostResource(name = "修改当前用户的多语言配置", path = "/i18n/changeUserTranslation", requiredPermission = false) - public ResponseData changeUserTranslation(@RequestBody @Validated(TranslationRequest.changeUserLanguage.class) TranslationRequest translationRequest) { + public ResponseData changeUserTranslation( + @RequestBody @Validated(TranslationRequest.changeUserLanguage.class) TranslationRequest translationRequest) { String token = LoginContext.me().getToken(); LoginUser loginUser = LoginContext.me().getLoginUser(); diff --git a/kernel-s-dict/dict-api/src/main/java/cn/stylefeng/roses/kernel/dict/api/DictApi.java b/kernel-s-dict/dict-api/src/main/java/cn/stylefeng/roses/kernel/dict/api/DictApi.java index b107c0d47..f9c5fba89 100644 --- a/kernel-s-dict/dict-api/src/main/java/cn/stylefeng/roses/kernel/dict/api/DictApi.java +++ b/kernel-s-dict/dict-api/src/main/java/cn/stylefeng/roses/kernel/dict/api/DictApi.java @@ -51,11 +51,12 @@ public interface DictApi { * 根据字典类型编码获取所有的字典 * * @param dictTypeCode 字典类型编码 + * @param searchText 查询条件,筛选字典类型下指定字符串的字典,可为空 * @return 字典的集合 * @author fengshuonan * @since 2021/1/27 22:13 */ - List getDictDetailsByDictTypeCode(String dictTypeCode); + List getDictDetailsByDictTypeCode(String dictTypeCode, String searchText); /** * 删除字典,通过dictId diff --git a/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/service/impl/DictServiceImpl.java b/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/service/impl/DictServiceImpl.java index a409e68f9..30322cc3f 100644 --- a/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/service/impl/DictServiceImpl.java +++ b/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/service/impl/DictServiceImpl.java @@ -219,7 +219,7 @@ public class DictServiceImpl extends ServiceImpl implements } @Override - public List getDictDetailsByDictTypeCode(String dictTypeCode) { + public List getDictDetailsByDictTypeCode(String dictTypeCode, String searchText) { // 获取字典类型编码对应的字典类型id Long dictTypeId = dictTypeService.getDictTypeIdByDictTypeCode(dictTypeCode); @@ -231,6 +231,7 @@ public class DictServiceImpl extends ServiceImpl implements // 查询字典的列表 DictRequest dictRequest = new DictRequest(); dictRequest.setDictTypeId(dictTypeId); + dictRequest.setSearchText(searchText); LambdaQueryWrapper wrapper = this.createWrapper(dictRequest); wrapper.select(SysDict::getDictId, SysDict::getDictName, SysDict::getDictCode); List dictList = this.list(wrapper); diff --git a/kernel-s-sys/sys-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/org/service/impl/HrOrgApproverServiceImpl.java b/kernel-s-sys/sys-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/org/service/impl/HrOrgApproverServiceImpl.java index c10028a74..36b62c94b 100644 --- a/kernel-s-sys/sys-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/org/service/impl/HrOrgApproverServiceImpl.java +++ b/kernel-s-sys/sys-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/org/service/impl/HrOrgApproverServiceImpl.java @@ -34,7 +34,8 @@ import java.util.stream.Collectors; * @date 2023/06/10 21:23 */ @Service -public class HrOrgApproverServiceImpl extends ServiceImpl implements HrOrgApproverService, RemoveOrgCallbackApi { +public class HrOrgApproverServiceImpl extends ServiceImpl implements HrOrgApproverService, + RemoveOrgCallbackApi { @Resource private DictApi dictApi; @@ -47,7 +48,7 @@ public class HrOrgApproverServiceImpl extends ServiceImpl getApproverTypeList() { - return dictApi.getDictDetailsByDictTypeCode(ApproverConstants.APPROVER_TYPE_DICT_TYPE_CODE); + return dictApi.getDictDetailsByDictTypeCode(ApproverConstants.APPROVER_TYPE_DICT_TYPE_CODE, null); } @Override @@ -65,7 +66,8 @@ public class HrOrgApproverServiceImpl extends ServiceImpl> groupingByUsers = orgTotalBindingList.stream().collect(Collectors.groupingBy(HrOrgApprover::getOrgApproverType)); + Map> groupingByUsers = orgTotalBindingList.stream() + .collect(Collectors.groupingBy(HrOrgApprover::getOrgApproverType)); // 先初始化空的绑定情况列表 ArrayList resultList = new ArrayList<>();