From f5a12b8da15dba5df9bd40637209431bca2faab6 Mon Sep 17 00:00:00 2001 From: mazhicheng Date: Sat, 21 Mar 2020 15:29:46 +0800 Subject: [PATCH] optimize imports --- .../file/controller/BaseExcelFileController.java | 8 ++++---- .../diboot/file/controller/BaseFileController.java | 6 +++--- .../com/diboot/file/excel/cache/DictTempCache.java | 3 --- .../file/excel/listener/FixedHeadExcelListener.java | 2 +- .../java/com/diboot/file/mapper/UploadFileMapper.java | 2 +- .../com/diboot/file/service/UploadFileService.java | 2 +- .../file/service/impl/UploadFileServiceImpl.java | 2 +- .../main/java/com/diboot/file/util/ExcelHelper.java | 6 +++--- .../main/java/com/diboot/file/util/FileHelper.java | 2 +- .../main/java/com/diboot/file/util/ImageHelper.java | 2 +- .../custom/listener/DepartmentImportListener.java | 4 +--- .../file/example/test/DynamicHeadExcelReadTest.java | 2 +- .../com/diboot/file/example/test/ExcelWriteTest.java | 2 +- .../file/example/test/FixedHeadExcelReadTest.java | 2 +- .../file/example/test/UploadFileServiceTest.java | 2 +- .../main/java/com/diboot/iam/jwt/BaseJwtRealm.java | 1 - .../diboot/iam/mapper/IamRolePermissionMapper.java | 2 -- .../impl/IamFrontendPermissionServiceImpl.java | 11 ++++++----- .../diboot/iam/service/impl/IamUserServiceImpl.java | 1 - .../com/diboot/iam/starter/IamBaseAutoConfig.java | 10 ---------- 20 files changed, 27 insertions(+), 45 deletions(-) diff --git a/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseExcelFileController.java b/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseExcelFileController.java index 93a7419..251c815 100644 --- a/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseExcelFileController.java +++ b/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseExcelFileController.java @@ -1,15 +1,15 @@ package com.diboot.file.controller; -import com.diboot.file.entity.UploadFile; -import com.diboot.file.excel.listener.FixedHeadExcelListener; -import com.diboot.file.util.ExcelHelper; -import com.diboot.file.util.FileHelper; import com.diboot.core.config.BaseConfig; import com.diboot.core.exception.BusinessException; import com.diboot.core.util.S; import com.diboot.core.util.V; import com.diboot.core.vo.JsonResult; import com.diboot.core.vo.Status; +import com.diboot.file.entity.UploadFile; +import com.diboot.file.excel.listener.FixedHeadExcelListener; +import com.diboot.file.util.ExcelHelper; +import com.diboot.file.util.FileHelper; import lombok.extern.slf4j.Slf4j; import org.springframework.web.multipart.MultipartFile; diff --git a/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseFileController.java b/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseFileController.java index a09c5f9..03d4b79 100644 --- a/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseFileController.java +++ b/diboot-file-starter/src/main/java/com/diboot/file/controller/BaseFileController.java @@ -1,9 +1,6 @@ package com.diboot.file.controller; import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.diboot.file.entity.UploadFile; -import com.diboot.file.service.UploadFileService; -import com.diboot.file.util.FileHelper; import com.diboot.core.controller.BaseController; import com.diboot.core.exception.BusinessException; import com.diboot.core.util.S; @@ -11,6 +8,9 @@ import com.diboot.core.util.V; import com.diboot.core.vo.JsonResult; import com.diboot.core.vo.Pagination; import com.diboot.core.vo.Status; +import com.diboot.file.entity.UploadFile; +import com.diboot.file.service.UploadFileService; +import com.diboot.file.util.FileHelper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.multipart.MultipartFile; diff --git a/diboot-file-starter/src/main/java/com/diboot/file/excel/cache/DictTempCache.java b/diboot-file-starter/src/main/java/com/diboot/file/excel/cache/DictTempCache.java index 65236c2..5b04d1b 100644 --- a/diboot-file-starter/src/main/java/com/diboot/file/excel/cache/DictTempCache.java +++ b/diboot-file-starter/src/main/java/com/diboot/file/excel/cache/DictTempCache.java @@ -1,14 +1,11 @@ package com.diboot.file.excel.cache; -import com.alibaba.excel.metadata.CellData; import com.diboot.core.binding.annotation.BindDict; -import com.diboot.core.exception.BusinessException; import com.diboot.core.service.DictionaryService; import com.diboot.core.util.BeanUtils; import com.diboot.core.util.ContextHelper; import com.diboot.core.util.V; import com.diboot.core.vo.KeyValue; -import com.diboot.core.vo.Status; import com.diboot.file.excel.BaseExcelModel; import lombok.extern.slf4j.Slf4j; diff --git a/diboot-file-starter/src/main/java/com/diboot/file/excel/listener/FixedHeadExcelListener.java b/diboot-file-starter/src/main/java/com/diboot/file/excel/listener/FixedHeadExcelListener.java index 619b3e9..e26f3f9 100644 --- a/diboot-file-starter/src/main/java/com/diboot/file/excel/listener/FixedHeadExcelListener.java +++ b/diboot-file-starter/src/main/java/com/diboot/file/excel/listener/FixedHeadExcelListener.java @@ -5,12 +5,12 @@ import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.excel.exception.ExcelDataConvertException; import com.alibaba.excel.metadata.Head; import com.alibaba.excel.read.metadata.property.ExcelReadHeadProperty; -import com.diboot.file.excel.BaseExcelModel; import com.diboot.core.exception.BusinessException; import com.diboot.core.util.BeanUtils; import com.diboot.core.util.S; import com.diboot.core.util.V; import com.diboot.core.vo.Status; +import com.diboot.file.excel.BaseExcelModel; import com.diboot.file.excel.cache.DictTempCache; import lombok.extern.slf4j.Slf4j; diff --git a/diboot-file-starter/src/main/java/com/diboot/file/mapper/UploadFileMapper.java b/diboot-file-starter/src/main/java/com/diboot/file/mapper/UploadFileMapper.java index 9c44c13..63baec0 100644 --- a/diboot-file-starter/src/main/java/com/diboot/file/mapper/UploadFileMapper.java +++ b/diboot-file-starter/src/main/java/com/diboot/file/mapper/UploadFileMapper.java @@ -1,7 +1,7 @@ package com.diboot.file.mapper; -import com.diboot.file.entity.UploadFile; import com.diboot.core.mapper.BaseCrudMapper; +import com.diboot.file.entity.UploadFile; import org.apache.ibatis.annotations.Mapper; /** diff --git a/diboot-file-starter/src/main/java/com/diboot/file/service/UploadFileService.java b/diboot-file-starter/src/main/java/com/diboot/file/service/UploadFileService.java index 7c710e2..35fb235 100644 --- a/diboot-file-starter/src/main/java/com/diboot/file/service/UploadFileService.java +++ b/diboot-file-starter/src/main/java/com/diboot/file/service/UploadFileService.java @@ -1,7 +1,7 @@ package com.diboot.file.service; -import com.diboot.file.entity.UploadFile; import com.diboot.core.service.BaseService; +import com.diboot.file.entity.UploadFile; import java.util.List; diff --git a/diboot-file-starter/src/main/java/com/diboot/file/service/impl/UploadFileServiceImpl.java b/diboot-file-starter/src/main/java/com/diboot/file/service/impl/UploadFileServiceImpl.java index a04193d..3a4be40 100644 --- a/diboot-file-starter/src/main/java/com/diboot/file/service/impl/UploadFileServiceImpl.java +++ b/diboot-file-starter/src/main/java/com/diboot/file/service/impl/UploadFileServiceImpl.java @@ -2,10 +2,10 @@ package com.diboot.file.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.diboot.core.service.impl.BaseServiceImpl; import com.diboot.file.entity.UploadFile; import com.diboot.file.mapper.UploadFileMapper; import com.diboot.file.service.UploadFileService; -import com.diboot.core.service.impl.BaseServiceImpl; import org.springframework.stereotype.Service; import java.util.List; diff --git a/diboot-file-starter/src/main/java/com/diboot/file/util/ExcelHelper.java b/diboot-file-starter/src/main/java/com/diboot/file/util/ExcelHelper.java index 62650c7..bd61d01 100644 --- a/diboot-file-starter/src/main/java/com/diboot/file/util/ExcelHelper.java +++ b/diboot-file-starter/src/main/java/com/diboot/file/util/ExcelHelper.java @@ -2,13 +2,13 @@ package com.diboot.file.util; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; -import com.diboot.file.excel.BaseExcelModel; -import com.diboot.file.excel.listener.DynamicHeadExcelListener; -import com.diboot.file.excel.listener.FixedHeadExcelListener; import com.diboot.core.exception.BusinessException; import com.diboot.core.util.BeanUtils; import com.diboot.core.util.V; import com.diboot.core.vo.Status; +import com.diboot.file.excel.BaseExcelModel; +import com.diboot.file.excel.listener.DynamicHeadExcelListener; +import com.diboot.file.excel.listener.FixedHeadExcelListener; import lombok.extern.slf4j.Slf4j; import java.io.File; diff --git a/diboot-file-starter/src/main/java/com/diboot/file/util/FileHelper.java b/diboot-file-starter/src/main/java/com/diboot/file/util/FileHelper.java index ca34209..0dd57f6 100644 --- a/diboot-file-starter/src/main/java/com/diboot/file/util/FileHelper.java +++ b/diboot-file-starter/src/main/java/com/diboot/file/util/FileHelper.java @@ -1,10 +1,10 @@ package com.diboot.file.util; -import com.diboot.file.config.Cons; import com.diboot.core.exception.BusinessException; import com.diboot.core.util.D; import com.diboot.core.util.PropertiesUtils; import com.diboot.core.vo.Status; +import com.diboot.file.config.Cons; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; diff --git a/diboot-file-starter/src/main/java/com/diboot/file/util/ImageHelper.java b/diboot-file-starter/src/main/java/com/diboot/file/util/ImageHelper.java index 28842db..0ae5978 100644 --- a/diboot-file-starter/src/main/java/com/diboot/file/util/ImageHelper.java +++ b/diboot-file-starter/src/main/java/com/diboot/file/util/ImageHelper.java @@ -1,8 +1,8 @@ package com.diboot.file.util; -import com.diboot.file.config.Cons; import com.diboot.core.util.D; import com.diboot.core.util.S; +import com.diboot.file.config.Cons; import lombok.extern.slf4j.Slf4j; import net.coobird.thumbnailator.Thumbnails; import net.coobird.thumbnailator.geometry.Positions; diff --git a/diboot-file-starter/src/test/java/com/diboot/file/example/custom/listener/DepartmentImportListener.java b/diboot-file-starter/src/test/java/com/diboot/file/example/custom/listener/DepartmentImportListener.java index eac18f7..f62eaeb 100644 --- a/diboot-file-starter/src/test/java/com/diboot/file/example/custom/listener/DepartmentImportListener.java +++ b/diboot-file-starter/src/test/java/com/diboot/file/example/custom/listener/DepartmentImportListener.java @@ -1,12 +1,10 @@ package com.diboot.file.example.custom.listener; -import com.diboot.file.excel.listener.FixedHeadExcelListener; import com.diboot.core.util.BeanUtils; import com.diboot.core.util.JSON; import com.diboot.file.example.custom.Department; import com.diboot.file.example.custom.DepartmentExcelModel; -import com.diboot.file.example.custom.service.DepartmentService; -import org.springframework.beans.factory.annotation.Autowired; +import com.diboot.file.excel.listener.FixedHeadExcelListener; import org.springframework.stereotype.Component; import java.util.List; diff --git a/diboot-file-starter/src/test/java/com/diboot/file/example/test/DynamicHeadExcelReadTest.java b/diboot-file-starter/src/test/java/com/diboot/file/example/test/DynamicHeadExcelReadTest.java index 849623b..7528118 100644 --- a/diboot-file-starter/src/test/java/com/diboot/file/example/test/DynamicHeadExcelReadTest.java +++ b/diboot-file-starter/src/test/java/com/diboot/file/example/test/DynamicHeadExcelReadTest.java @@ -1,8 +1,8 @@ package com.diboot.file.example.test; +import com.diboot.core.util.JSON; import com.diboot.file.excel.listener.DynamicHeadExcelListener; import com.diboot.file.util.ExcelHelper; -import com.diboot.core.util.JSON; import org.junit.Assert; import org.junit.Test; diff --git a/diboot-file-starter/src/test/java/com/diboot/file/example/test/ExcelWriteTest.java b/diboot-file-starter/src/test/java/com/diboot/file/example/test/ExcelWriteTest.java index 316e0c8..d43034d 100644 --- a/diboot-file-starter/src/test/java/com/diboot/file/example/test/ExcelWriteTest.java +++ b/diboot-file-starter/src/test/java/com/diboot/file/example/test/ExcelWriteTest.java @@ -1,9 +1,9 @@ package com.diboot.file.example.test; +import com.diboot.file.example.ApplicationTest; import com.diboot.file.util.ExcelHelper; import com.diboot.file.util.FileHelper; -import com.diboot.file.example.ApplicationTest; import org.junit.Assert; import org.junit.Test; diff --git a/diboot-file-starter/src/test/java/com/diboot/file/example/test/FixedHeadExcelReadTest.java b/diboot-file-starter/src/test/java/com/diboot/file/example/test/FixedHeadExcelReadTest.java index f5aedb2..c462878 100644 --- a/diboot-file-starter/src/test/java/com/diboot/file/example/test/FixedHeadExcelReadTest.java +++ b/diboot-file-starter/src/test/java/com/diboot/file/example/test/FixedHeadExcelReadTest.java @@ -1,10 +1,10 @@ package com.diboot.file.example.test; import com.diboot.core.util.JSON; -import com.diboot.file.util.ExcelHelper; import com.diboot.core.vo.Status; import com.diboot.file.example.custom.DepartmentExcelModel; import com.diboot.file.example.custom.listener.DepartmentImportListener; +import com.diboot.file.util.ExcelHelper; import org.junit.Assert; import org.junit.Test; diff --git a/diboot-file-starter/src/test/java/com/diboot/file/example/test/UploadFileServiceTest.java b/diboot-file-starter/src/test/java/com/diboot/file/example/test/UploadFileServiceTest.java index 3858854..0201565 100644 --- a/diboot-file-starter/src/test/java/com/diboot/file/example/test/UploadFileServiceTest.java +++ b/diboot-file-starter/src/test/java/com/diboot/file/example/test/UploadFileServiceTest.java @@ -1,9 +1,9 @@ package com.diboot.file.example.test; import com.diboot.file.entity.UploadFile; -import com.diboot.file.service.UploadFileService; import com.diboot.file.example.ApplicationTest; import com.diboot.file.example.custom.Department; +import com.diboot.file.service.UploadFileService; import org.junit.Assert; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/iam-base-starter/src/main/java/com/diboot/iam/jwt/BaseJwtRealm.java b/iam-base-starter/src/main/java/com/diboot/iam/jwt/BaseJwtRealm.java index 4125080..9cdf5d6 100644 --- a/iam-base-starter/src/main/java/com/diboot/iam/jwt/BaseJwtRealm.java +++ b/iam-base-starter/src/main/java/com/diboot/iam/jwt/BaseJwtRealm.java @@ -14,7 +14,6 @@ import com.diboot.iam.service.IamRolePermissionService; import com.diboot.iam.service.IamUserRoleService; import com.diboot.iam.util.IamSecurityUtils; import lombok.extern.slf4j.Slf4j; -import org.apache.shiro.SecurityUtils; import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.AuthenticationToken; diff --git a/iam-base-starter/src/main/java/com/diboot/iam/mapper/IamRolePermissionMapper.java b/iam-base-starter/src/main/java/com/diboot/iam/mapper/IamRolePermissionMapper.java index 4176538..d417dae 100644 --- a/iam-base-starter/src/main/java/com/diboot/iam/mapper/IamRolePermissionMapper.java +++ b/iam-base-starter/src/main/java/com/diboot/iam/mapper/IamRolePermissionMapper.java @@ -4,8 +4,6 @@ import com.diboot.core.mapper.BaseCrudMapper; import com.diboot.iam.entity.IamRolePermission; import org.apache.ibatis.annotations.Mapper; -import java.util.List; - /** * 角色权限关联Mapper * @author mazc@dibo.ltd diff --git a/iam-base-starter/src/main/java/com/diboot/iam/service/impl/IamFrontendPermissionServiceImpl.java b/iam-base-starter/src/main/java/com/diboot/iam/service/impl/IamFrontendPermissionServiceImpl.java index 74d8e57..0dddb9c 100644 --- a/iam-base-starter/src/main/java/com/diboot/iam/service/impl/IamFrontendPermissionServiceImpl.java +++ b/iam-base-starter/src/main/java/com/diboot/iam/service/impl/IamFrontendPermissionServiceImpl.java @@ -6,7 +6,6 @@ import com.diboot.core.exception.BusinessException; import com.diboot.core.util.BeanUtils; import com.diboot.core.util.S; import com.diboot.core.util.V; -import com.diboot.core.vo.JsonResult; import com.diboot.core.vo.Status; import com.diboot.iam.config.Cons; import com.diboot.iam.dto.IamFrontendPermissionDTO; @@ -63,10 +62,11 @@ public class IamFrontendPermissionServiceImpl extends BaseIamServiceImpl permissionList = iamFrontendPermissionDTO.getPermissionList(); - if (V.isEmpty(permissionList)){ + List permissionDTOList = iamFrontendPermissionDTO.getPermissionList(); + if (V.isEmpty(permissionDTOList)){ return; } + List permissionList = BeanUtils.convertList(permissionDTOList, IamFrontendPermission.class); // 设置每一条按钮/权限的parentId与接口列表 permissionList.forEach(p -> { p.setParentId(iamFrontendPermissionDTO.getId()); @@ -98,7 +98,7 @@ public class IamFrontendPermissionServiceImpl extends BaseIamServiceImpl V.notEmpty(p.getId())) .collect(Collectors.toList()); // 需要新建的列表 - List createPermissionList = permissionList.stream() + List createPermissionDTOList = permissionList.stream() .filter(p -> V.isEmpty(p.getId())) .collect(Collectors.toList()); List updatePermissionIdList = updatePermissionList.stream() @@ -120,7 +120,8 @@ public class IamFrontendPermissionServiceImpl extends BaseIamServiceImpl createPermissionList = BeanUtils.convertList(createPermissionDTOList, IamFrontendPermission.class); this.createEntities(createPermissionList); } // 批量更新按钮/权限列表 diff --git a/iam-base-starter/src/main/java/com/diboot/iam/service/impl/IamUserServiceImpl.java b/iam-base-starter/src/main/java/com/diboot/iam/service/impl/IamUserServiceImpl.java index 8935db5..4c8a819 100644 --- a/iam-base-starter/src/main/java/com/diboot/iam/service/impl/IamUserServiceImpl.java +++ b/iam-base-starter/src/main/java/com/diboot/iam/service/impl/IamUserServiceImpl.java @@ -16,7 +16,6 @@ import com.diboot.iam.service.IamFrontendPermissionService; import com.diboot.iam.service.IamUserRoleService; import com.diboot.iam.service.IamUserService; import com.diboot.iam.util.IamSecurityUtils; -import com.diboot.iam.vo.IamFrontendPermissionVO; import com.diboot.iam.vo.IamRoleVO; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; diff --git a/iam-base-starter/src/main/java/com/diboot/iam/starter/IamBaseAutoConfig.java b/iam-base-starter/src/main/java/com/diboot/iam/starter/IamBaseAutoConfig.java index 1d95fa7..af6393b 100644 --- a/iam-base-starter/src/main/java/com/diboot/iam/starter/IamBaseAutoConfig.java +++ b/iam-base-starter/src/main/java/com/diboot/iam/starter/IamBaseAutoConfig.java @@ -1,10 +1,6 @@ package com.diboot.iam.starter; -import com.alibaba.fastjson.serializer.SerializerFeature; -import com.alibaba.fastjson.support.config.FastJsonConfig; -import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; import com.diboot.core.service.impl.DictionaryServiceImpl; -import com.diboot.core.util.D; import com.diboot.core.util.DateConverter; import com.diboot.core.util.V; import com.diboot.iam.config.Cons; @@ -21,7 +17,6 @@ import org.mybatis.spring.annotation.MapperScan; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.http.HttpMessageConverters; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -30,15 +25,10 @@ import org.springframework.context.annotation.DependsOn; import org.springframework.core.annotation.Order; import org.springframework.core.env.Environment; import org.springframework.format.FormatterRegistry; -import org.springframework.http.MediaType; -import org.springframework.http.converter.HttpMessageConverter; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import javax.servlet.Filter; -import java.nio.charset.Charset; -import java.util.ArrayList; import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; /**