From 17ec9cbe3bfd1e260d18fdef553b19a1beab1bb0 Mon Sep 17 00:00:00 2001 From: Bunny <1319900154@qq.com> Date: Thu, 5 Dec 2024 23:02:28 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ControllerStringParamTrimConfig.java | 4 +- .../common/service/config/Knife4jConfig.java | 6 +- .../service/config/MybatisPlusConfig.java | 2 +- ...eption.java => AuthCustomerException.java} | 8 +- .../exception/GlobalExceptionHandler.java | 4 +- .../bunny/common/service/utils/HttpUtil.java | 206 ------------------ .../bunny/common/service/utils/JwtHelper.java | 20 +- .../service/utils/ResponseHandlerUtil.java | 12 - .../common/service/utils/minio/MinioUtil.java | 15 +- ...omeDto.java => IncomeExpenseQueryDto.java} | 4 +- ...tUserDto.java => BillImportByUserDto.java} | 4 +- ...lAddUserDto.java => BillAddByUserDto.java} | 4 +- ...eUserDto.java => BillUpdateByUserDto.java} | 4 +- ...o.java => BudgetCategoryAddByUserDto.java} | 4 +- ...ava => BudgetCategoryUpdateByUserDto.java} | 4 +- ...rAddDto.java => CategoryAddByUserDto.java} | 4 +- ...eDto.java => CategoryUpdateByUserDto.java} | 4 +- ...ava => DebtRepaymentPlanAddByUserDto.java} | 4 +- ... => DebtRepaymentPlanUpdateByUserDto.java} | 4 +- ...Dto.java => DebtTrackingAddByUserDto.java} | 4 +- ....java => DebtTrackingUpdateByUserDto.java} | 4 +- ...erDto.java => SavingGoalAddByUserDto.java} | 4 +- ...to.java => SavingGoalUpdateByUserDto.java} | 4 +- ...tExcel.java => BillExportExcelByUser.java} | 4 +- .../bunny/services/aop/AnnotationScanner.java | 4 +- .../controller/financial/BillController.java | 12 +- .../financial/BudgetCategoryController.java | 8 +- .../financial/CategoryController.java | 11 +- .../DebtRepaymentPlanController.java | 8 +- .../financial/DebtTrackingController.java | 8 +- .../financial/SavingGoalController.java | 8 +- .../bunny/services/excel/BillAddUserDAO.java | 22 +- .../services/excel/BillAddUserListener.java | 8 +- .../bunny/services/factory/BillFactory.java | 26 +-- .../bunny/services/factory/EmailFactory.java | 8 +- .../services/mapper/financial/BillMapper.java | 4 +- .../impl/CustomUserDetailsServiceImpl.java | 4 +- .../impl/ConfigurationServiceImpl.java | 8 +- .../impl/MenuIconServiceImpl.java | 4 +- .../email/impl/EmailTemplateServiceImpl.java | 6 +- .../email/impl/EmailUsersServiceImpl.java | 4 +- .../service/financial/BillService.java | 12 +- .../financial/BudgetCategoryService.java | 8 +- .../service/financial/CategoryService.java | 11 +- .../financial/DebtRepaymentPlanService.java | 8 +- .../financial/DebtTrackingService.java | 8 +- .../service/financial/SavingGoalService.java | 8 +- .../financial/impl/BillServiceImpl.java | 22 +- .../impl/BudgetCategoryServiceImpl.java | 12 +- .../financial/impl/CategoryServiceImpl.java | 17 +- .../impl/DebtRepaymentPlanServiceImpl.java | 12 +- .../impl/DebtTrackingServiceImpl.java | 12 +- .../financial/impl/SavingGoalServiceImpl.java | 12 +- .../service/i18n/impl/I18nServiceImpl.java | 8 +- .../i18n/impl/I18nTypeServiceImpl.java | 8 +- .../service/index/impl/IndexServiceImpl.java | 12 +- .../impl/MessageReceivedServiceImpl.java | 8 +- .../message/impl/MessageServiceImpl.java | 4 +- .../schedule/impl/SchedulersServiceImpl.java | 10 +- .../service/system/impl/DeptServiceImpl.java | 6 +- .../service/system/impl/FilesServiceImpl.java | 12 +- .../service/system/impl/PowerServiceImpl.java | 10 +- .../service/system/impl/RoleServiceImpl.java | 6 +- .../system/impl/RouterRoleServiceImpl.java | 4 +- .../system/impl/RouterServiceImpl.java | 10 +- .../system/impl/UserRoleServiceImpl.java | 6 +- .../service/system/impl/UserServiceImpl.java | 30 +-- .../financial/impl/BillServiceImplTest.java | 32 +-- 68 files changed, 288 insertions(+), 510 deletions(-) rename common/service-utils/src/main/java/cn/bunny/common/service/exception/{BunnyException.java => AuthCustomerException.java} (73%) delete mode 100644 common/service-utils/src/main/java/cn/bunny/common/service/utils/HttpUtil.java delete mode 100644 common/service-utils/src/main/java/cn/bunny/common/service/utils/ResponseHandlerUtil.java rename dao/src/main/java/cn/bunny/dao/dto/financial/bill/{ExpendWithIncomeDto.java => IncomeExpenseQueryDto.java} (84%) rename dao/src/main/java/cn/bunny/dao/dto/financial/bill/excel/{BillImportUserDto.java => BillImportByUserDto.java} (87%) rename dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/{BillAddUserDto.java => BillAddByUserDto.java} (90%) rename dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/{BillUpdateUserDto.java => BillUpdateByUserDto.java} (89%) rename dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/{BudgetCategoryAddUserDto.java => BudgetCategoryAddByUserDto.java} (92%) rename dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/{BudgetCategoryUpdateUserDto.java => BudgetCategoryUpdateByUserDto.java} (92%) rename dao/src/main/java/cn/bunny/dao/dto/financial/category/user/{CategoryUserAddDto.java => CategoryAddByUserDto.java} (79%) rename dao/src/main/java/cn/bunny/dao/dto/financial/category/user/{CategoryUserUpdateDto.java => CategoryUpdateByUserDto.java} (81%) rename dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/{DebtRepaymentPlanAddUserDto.java => DebtRepaymentPlanAddByUserDto.java} (89%) rename dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/{DebtRepaymentPlanUpdateUserDto.java => DebtRepaymentPlanUpdateByUserDto.java} (89%) rename dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/{DebtTrackingAddUserDto.java => DebtTrackingAddByUserDto.java} (91%) rename dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/{DebtTrackingUpdateUserDto.java => DebtTrackingUpdateByUserDto.java} (91%) rename dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/{SavingGoalAddUserDto.java => SavingGoalAddByUserDto.java} (92%) rename dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/{SavingGoalUpdateUserDto.java => SavingGoalUpdateByUserDto.java} (92%) rename dao/src/main/java/cn/bunny/dao/excel/{BillUserExportExcel.java => BillExportExcelByUser.java} (88%) diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/config/ControllerStringParamTrimConfig.java b/common/service-utils/src/main/java/cn/bunny/common/service/config/ControllerStringParamTrimConfig.java index 2694d23..2d04383 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/config/ControllerStringParamTrimConfig.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/config/ControllerStringParamTrimConfig.java @@ -26,7 +26,7 @@ public class ControllerStringParamTrimConfig { // 为 String 类对象注册编辑器 binder.registerCustomEditor(String.class, propertyEditor); } - + @Bean public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { return jacksonObjectMapperBuilder -> { @@ -35,8 +35,6 @@ public class ControllerStringParamTrimConfig { .deserializerByType(String.class, new StdScalarDeserializer(String.class) { @Override public String deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException { - // 去除全部空格 - // return StringUtils.trimAllWhitespace(jsonParser.getValueAsString()); // 仅去除前后空格 return jsonParser.getValueAsString().trim(); } diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java b/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java index c06abee..fc80c2e 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/config/Knife4jConfig.java @@ -16,11 +16,11 @@ public class Knife4jConfig { @Bean public OpenAPI openAPI() { // 作者等信息 - Contact contact = new Contact().name("Bunny").email("1319900154@qq.com").url("http://z-bunny.cn"); + Contact contact = new Contact().name("Bunny").email("1319900154@qq.com").url("http://bunny-web.site"); // 使用协议 License license = new License().name("MIT").url("https://MUT.com"); // 相关信息 - Info info = new Info().title("Bunny-Admin").description("权限管理模板").version("v1.0.0").contact(contact).license(license).termsOfService("MIT"); + Info info = new Info().title("家庭理财管理系统").description("家庭理财管理系统").version("v1.0.0").contact(contact).license(license).termsOfService("MIT"); return new OpenAPI().info(info).externalDocs(new ExternalDocumentation()); } @@ -28,6 +28,6 @@ public class Knife4jConfig { // 管理员相关分类接口 @Bean public GroupedOpenApi groupedOpenAdminApi() { - return GroupedOpenApi.builder().group("默认请求接口").pathsToMatch("/admin/**").build(); + return GroupedOpenApi.builder().group("后台管理").pathsToMatch("/admin/**").build(); } } diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/config/MybatisPlusConfig.java b/common/service-utils/src/main/java/cn/bunny/common/service/config/MybatisPlusConfig.java index beb7258..8cd1711 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/config/MybatisPlusConfig.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/config/MybatisPlusConfig.java @@ -23,7 +23,7 @@ public class MybatisPlusConfig { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); // 分页插件 PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor(DbType.MYSQL); - // 设置最大分页为100 + // 设置最大分页为 600 paginationInnerInterceptor.setMaxLimit(600L); interceptor.addInnerInterceptor(paginationInnerInterceptor); // 乐观锁 diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/exception/BunnyException.java b/common/service-utils/src/main/java/cn/bunny/common/service/exception/AuthCustomerException.java similarity index 73% rename from common/service-utils/src/main/java/cn/bunny/common/service/exception/BunnyException.java rename to common/service-utils/src/main/java/cn/bunny/common/service/exception/AuthCustomerException.java index 8be833a..2d9f719 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/exception/BunnyException.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/exception/AuthCustomerException.java @@ -10,24 +10,24 @@ import lombok.extern.slf4j.Slf4j; @Getter @ToString @Slf4j -public class BunnyException extends RuntimeException { +public class AuthCustomerException extends RuntimeException { Integer code;// 状态码 String message;// 描述信息 ResultCodeEnum resultCodeEnum; - public BunnyException(Integer code, String message) { + public AuthCustomerException(Integer code, String message) { super(message); this.code = code; this.message = message; } - public BunnyException(String message) { + public AuthCustomerException(String message) { super(message); this.message = message; } - public BunnyException(ResultCodeEnum codeEnum) { + public AuthCustomerException(ResultCodeEnum codeEnum) { super(codeEnum.getMessage()); this.code = codeEnum.getCode(); this.message = codeEnum.getMessage(); diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/exception/GlobalExceptionHandler.java b/common/service-utils/src/main/java/cn/bunny/common/service/exception/GlobalExceptionHandler.java index cc39b7b..b8c1dd0 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/exception/GlobalExceptionHandler.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/exception/GlobalExceptionHandler.java @@ -21,9 +21,9 @@ import java.util.stream.Collectors; @Slf4j public class GlobalExceptionHandler { // 自定义异常信息 - @ExceptionHandler(BunnyException.class) + @ExceptionHandler(AuthCustomerException.class) @ResponseBody - public Result exceptionHandler(BunnyException exception) { + public Result exceptionHandler(AuthCustomerException exception) { Integer code = exception.getCode() != null ? exception.getCode() : 500; return Result.error(null, code, exception.getMessage()); } diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/utils/HttpUtil.java b/common/service-utils/src/main/java/cn/bunny/common/service/utils/HttpUtil.java deleted file mode 100644 index bfb9b51..0000000 --- a/common/service-utils/src/main/java/cn/bunny/common/service/utils/HttpUtil.java +++ /dev/null @@ -1,206 +0,0 @@ -package cn.bunny.common.service.utils; - -import org.apache.commons.lang3.StringUtils; -import org.apache.http.HttpResponse; -import org.apache.http.NameValuePair; -import org.apache.http.client.HttpClient; -import org.apache.http.client.entity.UrlEncodedFormEntity; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.conn.ClientConnectionManager; -import org.apache.http.conn.scheme.Scheme; -import org.apache.http.conn.scheme.SchemeRegistry; -import org.apache.http.conn.ssl.SSLSocketFactory; -import org.apache.http.entity.ByteArrayEntity; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.http.message.BasicNameValuePair; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class HttpUtil { - public static HttpResponse doGet(String host, String path, String method, Map headers, Map querys) throws Exception { - HttpClient httpClient = wrapClient(host); - - HttpGet request = new HttpGet(buildUrl(host, path, querys)); - for (Map.Entry e : headers.entrySet()) { - request.addHeader(e.getKey(), e.getValue()); - } - - return httpClient.execute(request); - } - - public static HttpResponse doPost(String host, String path, String method, Map headers, Map querys, Map bodys) throws Exception { - HttpClient httpClient = wrapClient(host); - - HttpPost request = new HttpPost(buildUrl(host, path, querys)); - for (Map.Entry e : headers.entrySet()) { - request.addHeader(e.getKey(), e.getValue()); - } - - if (bodys != null) { - List nameValuePairList = new ArrayList(); - - for (String key : bodys.keySet()) { - nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); - } - UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); - formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8"); - request.setEntity(formEntity); - } - - return httpClient.execute(request); - } - - - public static HttpResponse doPost(String host, String path, String method, Map headers, Map querys, String body) throws Exception { - HttpClient httpClient = wrapClient(host); - - HttpPost request = new HttpPost(buildUrl(host, path, querys)); - for (Map.Entry e : headers.entrySet()) { - request.addHeader(e.getKey(), e.getValue()); - } - - if (StringUtils.isNotBlank(body)) { - request.setEntity(new StringEntity(body, "utf-8")); - } - - return httpClient.execute(request); - } - - - public static HttpResponse doPost(String host, String path, String method, Map headers, Map querys, byte[] body) throws Exception { - HttpClient httpClient = wrapClient(host); - - HttpPost request = new HttpPost(buildUrl(host, path, querys)); - for (Map.Entry e : headers.entrySet()) { - request.addHeader(e.getKey(), e.getValue()); - } - - if (body != null) { - request.setEntity(new ByteArrayEntity(body)); - } - - return httpClient.execute(request); - } - - - public static HttpResponse doPut(String host, String path, String method, Map headers, Map querys, String body) throws Exception { - HttpClient httpClient = wrapClient(host); - - HttpPut request = new HttpPut(buildUrl(host, path, querys)); - for (Map.Entry e : headers.entrySet()) { - request.addHeader(e.getKey(), e.getValue()); - } - - if (StringUtils.isNotBlank(body)) { - request.setEntity(new StringEntity(body, "utf-8")); - } - - return httpClient.execute(request); - } - - - public static HttpResponse doPut(String host, String path, String method, Map headers, Map querys, byte[] body) throws Exception { - HttpClient httpClient = wrapClient(host); - - HttpPut request = new HttpPut(buildUrl(host, path, querys)); - for (Map.Entry e : headers.entrySet()) { - request.addHeader(e.getKey(), e.getValue()); - } - - if (body != null) { - request.setEntity(new ByteArrayEntity(body)); - } - - return httpClient.execute(request); - } - - - public static HttpResponse doDelete(String host, String path, String method, Map headers, Map querys) throws Exception { - HttpClient httpClient = wrapClient(host); - - HttpDelete request = new HttpDelete(buildUrl(host, path, querys)); - for (Map.Entry e : headers.entrySet()) { - request.addHeader(e.getKey(), e.getValue()); - } - - return httpClient.execute(request); - } - - private static String buildUrl(String host, String path, Map querys) throws UnsupportedEncodingException { - StringBuilder sbUrl = new StringBuilder(); - sbUrl.append(host); - if (!StringUtils.isBlank(path)) { - sbUrl.append(path); - } - if (null != querys) { - StringBuilder sbQuery = new StringBuilder(); - for (Map.Entry query : querys.entrySet()) { - if (!sbQuery.isEmpty()) { - sbQuery.append("&"); - } - if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) { - sbQuery.append(query.getValue()); - } - if (!StringUtils.isBlank(query.getKey())) { - sbQuery.append(query.getKey()); - if (!StringUtils.isBlank(query.getValue())) { - sbQuery.append("="); - sbQuery.append(URLEncoder.encode(query.getValue(), StandardCharsets.UTF_8)); - } - } - } - if (!sbQuery.isEmpty()) { - sbUrl.append("?").append(sbQuery); - } - } - - return sbUrl.toString(); - } - - private static HttpClient wrapClient(String host) { - HttpClient httpClient = new DefaultHttpClient(); - if (host.startsWith("https://")) { - sslClient(httpClient); - } - - return httpClient; - } - - private static void sslClient(HttpClient httpClient) { - try { - SSLContext ctx = SSLContext.getInstance("TLS"); - X509TrustManager tm = new X509TrustManager() { - public X509Certificate[] getAcceptedIssuers() { - return null; - } - - public void checkClientTrusted(X509Certificate[] xcs, String str) { - } - - public void checkServerTrusted(X509Certificate[] xcs, String str) { - } - }; - ctx.init(null, new TrustManager[]{tm}, null); - SSLSocketFactory ssf = new SSLSocketFactory(ctx); - ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); - ClientConnectionManager ccm = httpClient.getConnectionManager(); - SchemeRegistry registry = ccm.getSchemeRegistry(); - registry.register(new Scheme("https", 443, ssf)); - } catch (Exception ex) { - throw new RuntimeException(); - } - } -} \ No newline at end of file diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/utils/JwtHelper.java b/common/service-utils/src/main/java/cn/bunny/common/service/utils/JwtHelper.java index efca21b..f331bdf 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/utils/JwtHelper.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/utils/JwtHelper.java @@ -1,6 +1,6 @@ package cn.bunny.common.service.utils; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.pojo.result.ResultCodeEnum; import io.jsonwebtoken.*; import io.micrometer.common.lang.Nullable; @@ -210,14 +210,14 @@ public class JwtHelper { */ public static Map getMapByToken(String token) { try { - if (!StringUtils.hasText(token)) throw new BunnyException(ResultCodeEnum.TOKEN_PARSING_FAILED); + if (!StringUtils.hasText(token)) throw new AuthCustomerException(ResultCodeEnum.TOKEN_PARSING_FAILED); Claims claims = Jwts.parser().setSigningKey(tokenSignKey).parseClaimsJws(token).getBody(); // 将 body 值转为map return new HashMap<>(claims); } catch (Exception exception) { - throw new BunnyException(ResultCodeEnum.TOKEN_PARSING_FAILED); + throw new AuthCustomerException(ResultCodeEnum.TOKEN_PARSING_FAILED); } } @@ -230,14 +230,14 @@ public class JwtHelper { */ public static Map getMapByToken(String token, String signKey) { try { - if (!StringUtils.hasText(token)) throw new BunnyException(ResultCodeEnum.TOKEN_PARSING_FAILED); + if (!StringUtils.hasText(token)) throw new AuthCustomerException(ResultCodeEnum.TOKEN_PARSING_FAILED); Jws claimsJws = Jwts.parser().setSigningKey(signKey).parseClaimsJws(token); Claims body = claimsJws.getBody(); // 将 body 值转为map return new HashMap<>(body); } catch (Exception exception) { - throw new BunnyException(ResultCodeEnum.TOKEN_PARSING_FAILED); + throw new AuthCustomerException(ResultCodeEnum.TOKEN_PARSING_FAILED); } } @@ -254,14 +254,14 @@ public class JwtHelper { @Nullable private static String getSubjectByTokenHandler(String token, String tokenSignKey) { try { - if (!StringUtils.hasText(token)) throw new BunnyException(ResultCodeEnum.TOKEN_PARSING_FAILED); + if (!StringUtils.hasText(token)) throw new AuthCustomerException(ResultCodeEnum.TOKEN_PARSING_FAILED); Jws claimsJws = Jwts.parser().setSigningKey(tokenSignKey).parseClaimsJws(token); Claims body = claimsJws.getBody(); return body.getSubject(); } catch (Exception exception) { - throw new BunnyException(ResultCodeEnum.TOKEN_PARSING_FAILED); + throw new AuthCustomerException(ResultCodeEnum.TOKEN_PARSING_FAILED); } } @@ -283,14 +283,14 @@ public class JwtHelper { */ public static Long getUserId(String token) { try { - if (!StringUtils.hasText(token)) throw new BunnyException(ResultCodeEnum.TOKEN_PARSING_FAILED); + if (!StringUtils.hasText(token)) throw new AuthCustomerException(ResultCodeEnum.TOKEN_PARSING_FAILED); Jws claimsJws = Jwts.parser().setSigningKey(tokenSignKey).parseClaimsJws(token); Claims claims = claimsJws.getBody(); return Long.valueOf(String.valueOf(claims.get("userId"))); } catch (Exception exception) { - throw new BunnyException(ResultCodeEnum.TOKEN_PARSING_FAILED); + throw new AuthCustomerException(ResultCodeEnum.TOKEN_PARSING_FAILED); } } @@ -308,7 +308,7 @@ public class JwtHelper { Claims claims = claimsJws.getBody(); return (String) claims.get("username"); } catch (Exception exception) { - throw new BunnyException(ResultCodeEnum.TOKEN_PARSING_FAILED); + throw new AuthCustomerException(ResultCodeEnum.TOKEN_PARSING_FAILED); } } diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/utils/ResponseHandlerUtil.java b/common/service-utils/src/main/java/cn/bunny/common/service/utils/ResponseHandlerUtil.java deleted file mode 100644 index 8bf9c91..0000000 --- a/common/service-utils/src/main/java/cn/bunny/common/service/utils/ResponseHandlerUtil.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.bunny.common.service.utils; - -import cn.bunny.dao.pojo.result.Result; -import cn.bunny.dao.pojo.result.ResultCodeEnum; -import jakarta.servlet.http.HttpServletResponse; - -public class ResponseHandlerUtil { - public static boolean loginAuthHandler(HttpServletResponse response, ResultCodeEnum loginAuth) { - ResponseUtil.out(response, Result.error(loginAuth)); - return false; - } -} diff --git a/common/service-utils/src/main/java/cn/bunny/common/service/utils/minio/MinioUtil.java b/common/service-utils/src/main/java/cn/bunny/common/service/utils/minio/MinioUtil.java index 12fe945..018e218 100644 --- a/common/service-utils/src/main/java/cn/bunny/common/service/utils/minio/MinioUtil.java +++ b/common/service-utils/src/main/java/cn/bunny/common/service/utils/minio/MinioUtil.java @@ -1,6 +1,6 @@ package cn.bunny.common.service.utils.minio; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.pojo.common.MinioFilePath; import cn.bunny.dao.pojo.constant.MinioConstant; import cn.bunny.dao.pojo.result.ResultCodeEnum; @@ -78,7 +78,7 @@ public class MinioUtil { public MinioFilePath uploadObjectReturnFilePath(MultipartFile file, String minioPreType) throws IOException { if (file == null) return null; String bucketName = properties.getBucketName(); - + // 上传对象 try { MinioFilePath minioFile = initUploadFileReturnMinioFilePath(bucketName, minioPreType, file); @@ -87,7 +87,8 @@ public class MinioUtil { return minioFile; } catch (Exception exception) { - throw new BunnyException(ResultCodeEnum.UPDATE_ERROR); + exception.printStackTrace(); + throw new AuthCustomerException(ResultCodeEnum.UPDATE_ERROR); } } @@ -107,7 +108,7 @@ public class MinioUtil { } catch (Exception exception) { exception.printStackTrace(); } - throw new BunnyException(ResultCodeEnum.GET_BUCKET_EXCEPTION); + throw new AuthCustomerException(ResultCodeEnum.GET_BUCKET_EXCEPTION); } /** @@ -135,7 +136,7 @@ public class MinioUtil { minioClient.putObject(PutObjectArgs.builder().bucket(bucketName).object(filename).stream(inputStream, size, -1).build()); } catch (Exception exception) { log.error("上传文件失败:{}", (Object) exception.getStackTrace()); - throw new BunnyException(ResultCodeEnum.UPDATE_ERROR); + throw new AuthCustomerException(ResultCodeEnum.UPDATE_ERROR); } } @@ -152,7 +153,7 @@ public class MinioUtil { Iterable> results = minioClient.removeObjects(RemoveObjectsArgs.builder().bucket(bucketName).objects(objectList).build()); for (Result result : results) { DeleteError error = result.get(); - throw new BunnyException("Error in deleting object " + error.objectName() + "; " + error.message()); + throw new AuthCustomerException("Error in deleting object " + error.objectName() + "; " + error.message()); } } catch (Exception exception) { exception.printStackTrace(); @@ -170,7 +171,7 @@ public class MinioUtil { try { putObject(bucketName, filepath, file.getInputStream(), file.getSize()); } catch (IOException e) { - throw new BunnyException(e.getMessage()); + throw new AuthCustomerException(e.getMessage()); } } } diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/bill/ExpendWithIncomeDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/bill/IncomeExpenseQueryDto.java similarity index 84% rename from dao/src/main/java/cn/bunny/dao/dto/financial/bill/ExpendWithIncomeDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/bill/IncomeExpenseQueryDto.java index 5477f8f..161562d 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/bill/ExpendWithIncomeDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/bill/IncomeExpenseQueryDto.java @@ -14,8 +14,8 @@ import java.time.LocalDate; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "ExpendWithIncomeDto对象", title = "账单收入和支出查询表单", description = "账单收入和支出查询表单") -public class ExpendWithIncomeDto { +@Schema(name = "IncomeExpenseQueryDto对象", title = "账单收入和支出查询表单", description = "账单收入和支出查询表单") +public class IncomeExpenseQueryDto { @Schema(name = "userId", title = "绑定的用户id") private Long userId; diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/bill/excel/BillImportUserDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/bill/excel/BillImportByUserDto.java similarity index 87% rename from dao/src/main/java/cn/bunny/dao/dto/financial/bill/excel/BillImportUserDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/bill/excel/BillImportByUserDto.java index 4bbb304..69588c4 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/bill/excel/BillImportUserDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/bill/excel/BillImportByUserDto.java @@ -15,8 +15,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "BillAddDto对象", title = "账单信息添加内容", description = "账单信息添加内容") -public class BillImportUserDto { +@Schema(name = "BillImportByUserDto对象", title = "账单信息添加内容", description = "账单信息添加内容") +public class BillImportByUserDto { @Schema(name = "username", title = "类型:1 - 收入,-1 - 支出") @ExcelProperty(index = 0) diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillAddUserDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillAddByUserDto.java similarity index 90% rename from dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillAddUserDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillAddByUserDto.java index f289df7..0df7c8d 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillAddUserDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillAddByUserDto.java @@ -17,8 +17,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "BillAddDto对象", title = "账单信息添加内容", description = "账单信息添加内容") -public class BillAddUserDto { +@Schema(name = "BillAddByUserDto对象", title = "账单信息添加内容", description = "账单信息添加内容") +public class BillAddByUserDto { @Schema(name = "username", title = "类型:1 - 收入,-1 - 支出") @NotNull(message = "类型不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillUpdateUserDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillUpdateByUserDto.java similarity index 89% rename from dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillUpdateUserDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillUpdateByUserDto.java index 37e4cd5..b21a520 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillUpdateUserDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/bill/user/BillUpdateByUserDto.java @@ -17,8 +17,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "BillUpdateDto对象", title = "账单信息更新内容", description = "账单信息更新内容") -public class BillUpdateUserDto { +@Schema(name = "BillUpdateByUserDto对象", title = "账单信息更新内容", description = "账单信息更新内容") +public class BillUpdateByUserDto { @Schema(name = "id", title = "主键") @NotNull(message = "id不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryAddUserDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryAddByUserDto.java similarity index 92% rename from dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryAddUserDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryAddByUserDto.java index ad935f2..a6be489 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryAddUserDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryAddByUserDto.java @@ -17,8 +17,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "BudgetCategoryAddDto对象", title = "预算分类添加", description = "预算分类添加") -public class BudgetCategoryAddUserDto { +@Schema(name = "BudgetCategoryAddByUserDto对象", title = "预算分类添加", description = "预算分类添加") +public class BudgetCategoryAddByUserDto { @Schema(name = "parentId", title = "父级id") @NotNull(message = "父级id不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryUpdateUserDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryUpdateByUserDto.java similarity index 92% rename from dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryUpdateUserDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryUpdateByUserDto.java index 6f9640b..2fcc851 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryUpdateUserDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/budgetCategory/user/BudgetCategoryUpdateByUserDto.java @@ -17,8 +17,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "BudgetCategoryUpdateDto对象", title = "预算分类更新", description = "预算分类更新") -public class BudgetCategoryUpdateUserDto { +@Schema(name = "BudgetCategoryUpdateByUserDto对象", title = "预算分类更新", description = "预算分类更新") +public class BudgetCategoryUpdateByUserDto { @Schema(name = "id", title = "主键") @NotNull(message = "id不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryUserAddDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryAddByUserDto.java similarity index 79% rename from dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryUserAddDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryAddByUserDto.java index 9a57a91..ea2499c 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryUserAddDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryAddByUserDto.java @@ -12,8 +12,8 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "CategoryUserAddDto对象", title = "分类信息添加", description = "分类信息添加") -public class CategoryUserAddDto { +@Schema(name = "CategoryAddByUserDto对象", title = "分类信息添加", description = "分类信息添加") +public class CategoryAddByUserDto { @Schema(name = "categoryName", title = "分类名称") @NotNull(message = "分类名称不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryUserUpdateDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryUpdateByUserDto.java similarity index 81% rename from dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryUserUpdateDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryUpdateByUserDto.java index 488a2b5..318cfe9 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryUserUpdateDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/category/user/CategoryUpdateByUserDto.java @@ -12,8 +12,8 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "CategoryUpdateDto对象", title = "分类信息添加", description = "分类信息添加") -public class CategoryUserUpdateDto { +@Schema(name = "CategoryUpdateByUserDto对象", title = "分类信息添加", description = "分类信息添加") +public class CategoryUpdateByUserDto { @Schema(name = "id", title = "主键") @NotNull(message = "id不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanAddUserDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanAddByUserDto.java similarity index 89% rename from dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanAddUserDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanAddByUserDto.java index fc9f82d..f16176c 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanAddUserDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanAddByUserDto.java @@ -17,8 +17,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "CategoryUserAddDto对象", title = "债务还款计划表添加", description = "债务还款计划表添加") -public class DebtRepaymentPlanAddUserDto { +@Schema(name = "DebtRepaymentPlanAddByUserDto对象", title = "债务还款计划表添加", description = "债务还款计划表添加") +public class DebtRepaymentPlanAddByUserDto { @Schema(name = "installmentNumber", title = "债务金额") @NotNull(message = "债务金额不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanUpdateUserDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanUpdateByUserDto.java similarity index 89% rename from dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanUpdateUserDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanUpdateByUserDto.java index 34e2469..bb6a3fb 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanUpdateUserDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/debtRepaymentPlan/user/DebtRepaymentPlanUpdateByUserDto.java @@ -17,8 +17,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "DebtRepaymentPlanUpdateDto对象", title = "债务还款计划更新", description = "债务还款计划更新") -public class DebtRepaymentPlanUpdateUserDto { +@Schema(name = "DebtRepaymentPlanUpdateByUserDto对象", title = "债务还款计划更新", description = "债务还款计划更新") +public class DebtRepaymentPlanUpdateByUserDto { @Schema(name = "id", title = "主键") @NotNull(message = "id不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingAddUserDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingAddByUserDto.java similarity index 91% rename from dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingAddUserDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingAddByUserDto.java index a6d10a5..b33a55c 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingAddUserDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingAddByUserDto.java @@ -17,8 +17,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "DebtTrackingAddDto对象", title = "债务追踪添加", description = "债务追踪") -public class DebtTrackingAddUserDto { +@Schema(name = "DebtTrackingAddByUserDto对象", title = "债务追踪添加", description = "债务追踪") +public class DebtTrackingAddByUserDto { @Schema(name = "debtorName", title = "债务人姓名") @NotNull(message = "债务人姓名不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingUpdateUserDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingUpdateByUserDto.java similarity index 91% rename from dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingUpdateUserDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingUpdateByUserDto.java index d37eeaa..9a968a3 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingUpdateUserDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/debtTracking/user/DebtTrackingUpdateByUserDto.java @@ -17,8 +17,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "DebtTrackingUpdateDto对象", title = "债务追踪更新", description = "债务追踪更新") -public class DebtTrackingUpdateUserDto { +@Schema(name = "DebtTrackingUpdateByUserDto对象", title = "债务追踪更新", description = "债务追踪更新") +public class DebtTrackingUpdateByUserDto { @Schema(name = "id", title = "主键") @NotNull(message = "id不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalAddUserDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalAddByUserDto.java similarity index 92% rename from dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalAddUserDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalAddByUserDto.java index eb6f2d8..8c7c8d0 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalAddUserDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalAddByUserDto.java @@ -17,8 +17,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "SavingGoalAddDto对象", title = "用户储值添加", description = "用户储值添加") -public class SavingGoalAddUserDto { +@Schema(name = "SavingGoalAddByUserDto对象", title = "用户储值添加", description = "用户储值添加") +public class SavingGoalAddByUserDto { @Schema(name = "statusType", title = "完成状态") @NotNull(message = "完成状态不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalUpdateUserDto.java b/dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalUpdateByUserDto.java similarity index 92% rename from dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalUpdateUserDto.java rename to dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalUpdateByUserDto.java index c381e80..8730d63 100644 --- a/dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalUpdateUserDto.java +++ b/dao/src/main/java/cn/bunny/dao/dto/financial/savingGoal/user/SavingGoalUpdateByUserDto.java @@ -17,8 +17,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "SavingGoalUpdateDto对象", title = "用户储值更新", description = "用户储值更新") -public class SavingGoalUpdateUserDto { +@Schema(name = "SavingGoalUpdateByUserDto对象", title = "用户储值更新", description = "用户储值更新") +public class SavingGoalUpdateByUserDto { @Schema(name = "id", title = "主键") @NotNull(message = "id不能为空") diff --git a/dao/src/main/java/cn/bunny/dao/excel/BillUserExportExcel.java b/dao/src/main/java/cn/bunny/dao/excel/BillExportExcelByUser.java similarity index 88% rename from dao/src/main/java/cn/bunny/dao/excel/BillUserExportExcel.java rename to dao/src/main/java/cn/bunny/dao/excel/BillExportExcelByUser.java index 1c9d87e..23094b1 100644 --- a/dao/src/main/java/cn/bunny/dao/excel/BillUserExportExcel.java +++ b/dao/src/main/java/cn/bunny/dao/excel/BillExportExcelByUser.java @@ -18,8 +18,8 @@ import java.time.LocalDateTime; @AllArgsConstructor @NoArgsConstructor @Builder -@Schema(name = "BillUserVo对象", title = "用户账单信息返回内容", description = "用户账单信息返回内容") -public class BillUserExportExcel extends BaseVo { +@Schema(name = "BillExportExcelByUser对象", title = "用户账单信息返回内容", description = "用户账单信息返回内容") +public class BillExportExcelByUser extends BaseVo { @Schema(name = "username", title = "类型:1 - 收入,-1 - 支出") @ExcelProperty("类型:1 - 收入,-1 - 支出") diff --git a/service/src/main/java/cn/bunny/services/aop/AnnotationScanner.java b/service/src/main/java/cn/bunny/services/aop/AnnotationScanner.java index 84ad11a..346336c 100644 --- a/service/src/main/java/cn/bunny/services/aop/AnnotationScanner.java +++ b/service/src/main/java/cn/bunny/services/aop/AnnotationScanner.java @@ -1,6 +1,6 @@ package cn.bunny.services.aop; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.pojo.result.ResultCodeEnum; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider; @@ -34,7 +34,7 @@ public class AnnotationScanner { Class clazz = Class.forName(bd.getBeanClassName()); classes.add(clazz); } catch (ClassNotFoundException e) { - throw new BunnyException(ResultCodeEnum.CLASS_NOT_FOUND); + throw new AuthCustomerException(ResultCodeEnum.CLASS_NOT_FOUND); } } diff --git a/service/src/main/java/cn/bunny/services/controller/financial/BillController.java b/service/src/main/java/cn/bunny/services/controller/financial/BillController.java index 45cb978..21f65ca 100644 --- a/service/src/main/java/cn/bunny/services/controller/financial/BillController.java +++ b/service/src/main/java/cn/bunny/services/controller/financial/BillController.java @@ -1,12 +1,12 @@ package cn.bunny.services.controller.financial; import cn.bunny.dao.dto.financial.bill.BillDto; -import cn.bunny.dao.dto.financial.bill.ExpendWithIncomeDto; +import cn.bunny.dao.dto.financial.bill.IncomeExpenseQueryDto; import cn.bunny.dao.dto.financial.bill.admin.BillAddDto; import cn.bunny.dao.dto.financial.bill.admin.BillUpdateDto; import cn.bunny.dao.dto.financial.bill.excel.BillExportDto; -import cn.bunny.dao.dto.financial.bill.user.BillAddUserDto; -import cn.bunny.dao.dto.financial.bill.user.BillUpdateUserDto; +import cn.bunny.dao.dto.financial.bill.user.BillAddByUserDto; +import cn.bunny.dao.dto.financial.bill.user.BillUpdateByUserDto; import cn.bunny.dao.entity.financial.Bill; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.pojo.result.Result; @@ -72,7 +72,7 @@ public class BillController { @Operation(summary = "账单收入和支出图表展示", description = "账单收入和支出图表展示") @GetMapping("noManage/getExpendOrIncome") - public Mono> getExpendOrIncome(ExpendWithIncomeDto dto) { + public Mono> getExpendOrIncome(IncomeExpenseQueryDto dto) { ExpendWithIncomeListVo vo = billService.getExpendOrIncome(dto); return Mono.just(Result.success(vo)); } @@ -105,7 +105,7 @@ public class BillController { @Operation(summary = "用户添加账单信息", description = "用户添加账单信息") @PostMapping("noManage/addUserBill") - public Mono> addUserBill(@Valid @RequestBody BillAddUserDto dto) { + public Mono> addUserBill(@Valid @RequestBody BillAddByUserDto dto) { billService.addUserBill(dto); return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS)); } @@ -119,7 +119,7 @@ public class BillController { @Operation(summary = "用户更新账单信息", description = "用户更新账单信息") @PutMapping("noManage/updateUserBill") - public Mono> updateUserBill(@Valid @RequestBody BillUpdateUserDto dto) { + public Mono> updateUserBill(@Valid @RequestBody BillUpdateByUserDto dto) { billService.updateUserBill(dto); return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS)); } diff --git a/service/src/main/java/cn/bunny/services/controller/financial/BudgetCategoryController.java b/service/src/main/java/cn/bunny/services/controller/financial/BudgetCategoryController.java index 0100354..b697d47 100644 --- a/service/src/main/java/cn/bunny/services/controller/financial/BudgetCategoryController.java +++ b/service/src/main/java/cn/bunny/services/controller/financial/BudgetCategoryController.java @@ -3,8 +3,8 @@ package cn.bunny.services.controller.financial; import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryDto; import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryAddDto; import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryUpdateDto; -import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddUserDto; -import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryUpdateUserDto; +import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddByUserDto; +import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryUpdateByUserDto; import cn.bunny.dao.entity.financial.BudgetCategory; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.pojo.result.Result; @@ -89,7 +89,7 @@ public class BudgetCategoryController { @Operation(summary = "用户添加预算分类表", description = "用户添加预算分类表") @PostMapping("noManage/addUserBudgetCategory") - public Mono> addUserBudgetCategory(@Valid @RequestBody BudgetCategoryAddUserDto dto) { + public Mono> addUserBudgetCategory(@Valid @RequestBody BudgetCategoryAddByUserDto dto) { budgetCategoryService.addUserBudgetCategory(dto); return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS)); } @@ -103,7 +103,7 @@ public class BudgetCategoryController { @Operation(summary = "用户更新预算分类表", description = "用户更新预算分类表") @PutMapping("noManage/updateUserBudgetCategory") - public Mono> updateUserBudgetCategory(@Valid @RequestBody BudgetCategoryUpdateUserDto dto) { + public Mono> updateUserBudgetCategory(@Valid @RequestBody BudgetCategoryUpdateByUserDto dto) { budgetCategoryService.updateUserBudgetCategory(dto); return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS)); } diff --git a/service/src/main/java/cn/bunny/services/controller/financial/CategoryController.java b/service/src/main/java/cn/bunny/services/controller/financial/CategoryController.java index 261f5e8..ec6b845 100644 --- a/service/src/main/java/cn/bunny/services/controller/financial/CategoryController.java +++ b/service/src/main/java/cn/bunny/services/controller/financial/CategoryController.java @@ -2,9 +2,8 @@ package cn.bunny.services.controller.financial; import cn.bunny.dao.dto.financial.category.CategoryDto; import cn.bunny.dao.dto.financial.category.admin.CategoryAddDto; -import cn.bunny.dao.dto.financial.category.admin.CategoryUpdateDto; -import cn.bunny.dao.dto.financial.category.user.CategoryUserAddDto; -import cn.bunny.dao.dto.financial.category.user.CategoryUserUpdateDto; +import cn.bunny.dao.dto.financial.category.user.CategoryAddByUserDto; +import cn.bunny.dao.dto.financial.category.user.CategoryUpdateByUserDto; import cn.bunny.dao.entity.financial.Category; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.pojo.result.Result; @@ -81,21 +80,21 @@ public class CategoryController { @Operation(summary = "用戶分类添加分类信息", description = "用戶分类添加分类信息") @PostMapping("noManage/addCategoryUser") - public Mono> addCategoryUser(@Valid @RequestBody CategoryUserAddDto dto) { + public Mono> addCategoryUser(@Valid @RequestBody CategoryAddByUserDto dto) { categoryService.addCategoryUser(dto); return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS)); } @Operation(summary = "更新分类信息", description = "更新分类信息") @PutMapping("updateCategory") - public Mono> updateCategory(@Valid @RequestBody CategoryUpdateDto dto) { + public Mono> updateCategory(@Valid @RequestBody cn.bunny.dao.dto.financial.category.admin.CategoryUpdateDto dto) { categoryService.updateCategory(dto); return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS)); } @Operation(summary = "用户分类更新分类信息", description = "用户分类更新分类信息") @PutMapping("noManage/updateCategoryUser") - public Mono> updateCategoryUser(@Valid @RequestBody CategoryUserUpdateDto dto) { + public Mono> updateCategoryUser(@Valid @RequestBody CategoryUpdateByUserDto dto) { categoryService.updateCategoryUser(dto); return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS)); } diff --git a/service/src/main/java/cn/bunny/services/controller/financial/DebtRepaymentPlanController.java b/service/src/main/java/cn/bunny/services/controller/financial/DebtRepaymentPlanController.java index 73a89e3..25df0c4 100644 --- a/service/src/main/java/cn/bunny/services/controller/financial/DebtRepaymentPlanController.java +++ b/service/src/main/java/cn/bunny/services/controller/financial/DebtRepaymentPlanController.java @@ -3,8 +3,8 @@ package cn.bunny.services.controller.financial; import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanDto; import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanAddDto; import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanUpdateDto; -import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanAddUserDto; -import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanUpdateUserDto; +import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanAddByUserDto; +import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanUpdateByUserDto; import cn.bunny.dao.entity.financial.DebtRepaymentPlan; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.pojo.result.Result; @@ -74,7 +74,7 @@ public class DebtRepaymentPlanController { @Operation(summary = "用户添加债务还款计划表", description = "用户添加债务还款计划表") @PostMapping("noManage/addUserDebtRepaymentPlan") - public Mono> addUserDebtRepaymentPlan(@Valid @RequestBody DebtRepaymentPlanAddUserDto dto) { + public Mono> addUserDebtRepaymentPlan(@Valid @RequestBody DebtRepaymentPlanAddByUserDto dto) { debtRepaymentPlanService.addUserDebtRepaymentPlan(dto); return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS)); } @@ -88,7 +88,7 @@ public class DebtRepaymentPlanController { @Operation(summary = "用户更新债务还款计划表", description = "用户更新债务还款计划表") @PutMapping("noManage/updateUserDebtRepaymentPlan") - public Mono> updateUserDebtRepaymentPlan(@Valid @RequestBody DebtRepaymentPlanUpdateUserDto dto) { + public Mono> updateUserDebtRepaymentPlan(@Valid @RequestBody DebtRepaymentPlanUpdateByUserDto dto) { debtRepaymentPlanService.updateUserDebtRepaymentPlan(dto); return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS)); } diff --git a/service/src/main/java/cn/bunny/services/controller/financial/DebtTrackingController.java b/service/src/main/java/cn/bunny/services/controller/financial/DebtTrackingController.java index e8ebca9..4450aec 100644 --- a/service/src/main/java/cn/bunny/services/controller/financial/DebtTrackingController.java +++ b/service/src/main/java/cn/bunny/services/controller/financial/DebtTrackingController.java @@ -3,8 +3,8 @@ package cn.bunny.services.controller.financial; import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingDto; import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingAddDto; import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingUpdateDto; -import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingAddUserDto; -import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingUpdateUserDto; +import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingAddByUserDto; +import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingUpdateByUserDto; import cn.bunny.dao.entity.financial.DebtTracking; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.pojo.result.Result; @@ -74,7 +74,7 @@ public class DebtTrackingController { @Operation(summary = "用户添加债务追踪", description = "用户添加债务追踪") @PostMapping("noManage/addUserDebtTracking") - public Mono> addUserDebtTracking(@Valid @RequestBody DebtTrackingAddUserDto dto) { + public Mono> addUserDebtTracking(@Valid @RequestBody DebtTrackingAddByUserDto dto) { debtTrackingService.addUserDebtTracking(dto); return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS)); } @@ -88,7 +88,7 @@ public class DebtTrackingController { @Operation(summary = "用户更新债务追踪", description = "用户更新债务追踪") @PutMapping("noManage/updateUserDebtTracking") - public Mono> updateUserDebtTracking(@Valid @RequestBody DebtTrackingUpdateUserDto dto) { + public Mono> updateUserDebtTracking(@Valid @RequestBody DebtTrackingUpdateByUserDto dto) { debtTrackingService.updateUserDebtTracking(dto); return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS)); } diff --git a/service/src/main/java/cn/bunny/services/controller/financial/SavingGoalController.java b/service/src/main/java/cn/bunny/services/controller/financial/SavingGoalController.java index 3122e10..adeaa85 100644 --- a/service/src/main/java/cn/bunny/services/controller/financial/SavingGoalController.java +++ b/service/src/main/java/cn/bunny/services/controller/financial/SavingGoalController.java @@ -3,8 +3,8 @@ package cn.bunny.services.controller.financial; import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto; import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalAddDto; import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalUpdateDto; -import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalAddUserDto; -import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalUpdateUserDto; +import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalAddByUserDto; +import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalUpdateByUserDto; import cn.bunny.dao.entity.financial.SavingGoal; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.pojo.result.Result; @@ -74,7 +74,7 @@ public class SavingGoalController { @Operation(summary = "用户添加储值", description = "用户添加储值") @PostMapping("noManage/adduserSavingGoal") - public Mono> adduserSavingGoal(@Valid @RequestBody SavingGoalAddUserDto dto) { + public Mono> adduserSavingGoal(@Valid @RequestBody SavingGoalAddByUserDto dto) { savingGoalService.adduserSavingGoal(dto); return Mono.just(Result.success(ResultCodeEnum.ADD_SUCCESS)); } @@ -88,7 +88,7 @@ public class SavingGoalController { @Operation(summary = "用户更新储值", description = "用户更新储值") @PutMapping("noManage/updateUserSavingGoal") - public Mono> updateUserSavingGoal(@Valid @RequestBody SavingGoalUpdateUserDto dto) { + public Mono> updateUserSavingGoal(@Valid @RequestBody SavingGoalUpdateByUserDto dto) { savingGoalService.updateUserSavingGoal(dto); return Mono.just(Result.success(ResultCodeEnum.UPDATE_SUCCESS)); } diff --git a/service/src/main/java/cn/bunny/services/excel/BillAddUserDAO.java b/service/src/main/java/cn/bunny/services/excel/BillAddUserDAO.java index ddc9e72..2aabfb4 100644 --- a/service/src/main/java/cn/bunny/services/excel/BillAddUserDAO.java +++ b/service/src/main/java/cn/bunny/services/excel/BillAddUserDAO.java @@ -1,7 +1,7 @@ package cn.bunny.services.excel; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.dao.dto.financial.bill.excel.BillImportUserDto; +import cn.bunny.dao.dto.financial.bill.excel.BillImportByUserDto; import cn.bunny.dao.entity.financial.Bill; import cn.bunny.dao.entity.financial.Category; import cn.bunny.services.mapper.financial.CategoryMapper; @@ -21,7 +21,7 @@ import java.util.stream.Collectors; public class BillAddUserDAO { - public void save(List cachedDataList, BillService billService, CategoryMapper categoryMapper, StrBuilder messageContent, AtomicReference index) { + public void save(List cachedDataList, BillService billService, CategoryMapper categoryMapper, StrBuilder messageContent, AtomicReference index) { Long userId = BaseContext.getUserId(); // 查询数据 @@ -30,13 +30,13 @@ public class BillAddUserDAO { List billList = cachedDataList.stream() // 判断是否有值 - .filter(billImportUserDto -> { + .filter(billImportByUserDto -> { index.updateAndGet(i -> i == null ? 1 : i + 1); - String billImportUserDtoType = billImportUserDto.getType(); - BigDecimal amount = billImportUserDto.getAmount(); - LocalDateTime transactionDate = billImportUserDto.getTransactionDate(); - String categoryName = billImportUserDto.getCategoryName(); + String billImportUserDtoType = billImportByUserDto.getType(); + BigDecimal amount = billImportByUserDto.getAmount(); + LocalDateTime transactionDate = billImportByUserDto.getTransactionDate(); + String categoryName = billImportByUserDto.getCategoryName(); if (StringUtils.isEmpty(billImportUserDtoType) || amount == null || StringUtils.isEmpty(categoryName) @@ -48,12 +48,12 @@ public class BillAddUserDAO { } return true; }) - .map(billImportUserDto -> { - String billImportUserDtoType = billImportUserDto.getType(); - String categoryName = billImportUserDto.getCategoryName(); + .map(billImportByUserDto -> { + String billImportUserDtoType = billImportByUserDto.getType(); + String categoryName = billImportByUserDto.getCategoryName(); Bill bill = new Bill(); - BeanUtils.copyProperties(billImportUserDto, bill); + BeanUtils.copyProperties(billImportByUserDto, bill); // 设置用户id bill.setUserId(userId); diff --git a/service/src/main/java/cn/bunny/services/excel/BillAddUserListener.java b/service/src/main/java/cn/bunny/services/excel/BillAddUserListener.java index 0e237a2..6a51f9b 100644 --- a/service/src/main/java/cn/bunny/services/excel/BillAddUserListener.java +++ b/service/src/main/java/cn/bunny/services/excel/BillAddUserListener.java @@ -1,7 +1,7 @@ package cn.bunny.services.excel; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.dao.dto.financial.bill.excel.BillImportUserDto; +import cn.bunny.dao.dto.financial.bill.excel.BillImportByUserDto; import cn.bunny.dao.entity.system.Message; import cn.bunny.dao.entity.system.MessageReceived; import cn.bunny.services.mapper.financial.CategoryMapper; @@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicReference; * 无法被Spring管理必须使用构造函数注入方式 */ @Slf4j -public class BillAddUserListener implements ReadListener { +public class BillAddUserListener implements ReadListener { // 缓存数据 private static final int BATCH_COUNT = 100; @@ -41,7 +41,7 @@ public class BillAddUserListener implements ReadListener { private final StrBuilder messageContent = new StrBuilder(); // 设置索引查看是第几个数据异常 AtomicReference index = new AtomicReference<>(1); - private List cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); + private List cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); public BillAddUserListener(CategoryMapper categoryMapper, MessageMapper messageMapper, MessageReceivedMapper messageReceivedMapper, BillService billService) { billAddUserDAO = new BillAddUserDAO(); @@ -68,7 +68,7 @@ public class BillAddUserListener implements ReadListener { * @param data one row value. Is is same as {@link AnalysisContext#readRowHolder()} */ @Override - public void invoke(BillImportUserDto data, AnalysisContext context) { + public void invoke(BillImportByUserDto data, AnalysisContext context) { cachedDataList.add(data); // 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM if (cachedDataList.size() >= BATCH_COUNT) { diff --git a/service/src/main/java/cn/bunny/services/factory/BillFactory.java b/service/src/main/java/cn/bunny/services/factory/BillFactory.java index 97205cc..ed7ee77 100644 --- a/service/src/main/java/cn/bunny/services/factory/BillFactory.java +++ b/service/src/main/java/cn/bunny/services/factory/BillFactory.java @@ -1,9 +1,9 @@ package cn.bunny.services.factory; -import cn.bunny.common.service.exception.BunnyException; -import cn.bunny.dao.dto.financial.bill.ExpendWithIncomeDto; +import cn.bunny.common.service.exception.AuthCustomerException; +import cn.bunny.dao.dto.financial.bill.IncomeExpenseQueryDto; import cn.bunny.dao.dto.financial.bill.excel.BillExportDto; -import cn.bunny.dao.excel.BillUserExportExcel; +import cn.bunny.dao.excel.BillExportExcelByUser; import cn.bunny.dao.pojo.result.ResultCodeEnum; import cn.bunny.dao.vo.financial.user.expendAndIncome.ExpendWithIncome; import cn.bunny.services.mapper.financial.BillMapper; @@ -42,19 +42,19 @@ public class BillFactory { String filename = URLEncoder.encode(dateRange, StandardCharsets.UTF_8).replaceAll("\\+", "%20"); // 初始化查询条件,将日期向后移一天查询包含当前的数据 - ExpendWithIncomeDto expendWithIncomeDto = new ExpendWithIncomeDto(); - BeanUtils.copyProperties(dto, expendWithIncomeDto); - expendWithIncomeDto.setEndDate(endDate.plusDays(1)); + IncomeExpenseQueryDto incomeExpenseQueryDto = new IncomeExpenseQueryDto(); + BeanUtils.copyProperties(dto, incomeExpenseQueryDto); + incomeExpenseQueryDto.setEndDate(endDate.plusDays(1)); // 设置收入和支出的值 AtomicReference income = new AtomicReference<>(new BigDecimal(0)); AtomicReference expend = new AtomicReference<>(new BigDecimal(0)); // 查询数据 - List expendWithIncomeList = billMapper.selectListByExpendWithIncomeDto(expendWithIncomeDto); - List excelList = expendWithIncomeList.stream().map(expendWithIncome -> { - BillUserExportExcel billUserExportExcel = new BillUserExportExcel(); - BeanUtils.copyProperties(expendWithIncome, billUserExportExcel); + List expendWithIncomeList = billMapper.selectListByExpendWithIncomeDto(incomeExpenseQueryDto); + List excelList = expendWithIncomeList.stream().map(expendWithIncome -> { + BillExportExcelByUser billExportExcelByUser = new BillExportExcelByUser(); + BeanUtils.copyProperties(expendWithIncome, billExportExcelByUser); // 设置收支类型 String type; @@ -65,14 +65,14 @@ public class BillFactory { type = "支出"; expend.updateAndGet(bigDecimal -> bigDecimal.add(expendWithIncome.getAmount())); } - billUserExportExcel.setType(type); + billExportExcelByUser.setType(type); - return billUserExportExcel; + return billExportExcelByUser; }).toList(); // 查找模板文件 String filenameTemplate = Objects.requireNonNull(getClass().getResource("/static/bill-template.xlsx")).getFile(); - if (filenameTemplate == null) throw new BunnyException(ResultCodeEnum.MISSING_TEMPLATE_FILES); + if (filenameTemplate == null) throw new AuthCustomerException(ResultCodeEnum.MISSING_TEMPLATE_FILES); try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(filenameTemplate).build()) { // 填充数据 diff --git a/service/src/main/java/cn/bunny/services/factory/EmailFactory.java b/service/src/main/java/cn/bunny/services/factory/EmailFactory.java index 2410570..5e7e4af 100644 --- a/service/src/main/java/cn/bunny/services/factory/EmailFactory.java +++ b/service/src/main/java/cn/bunny/services/factory/EmailFactory.java @@ -1,6 +1,6 @@ package cn.bunny.services.factory; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.common.service.utils.mail.MailSenderUtil; import cn.bunny.dao.entity.system.EmailTemplate; import cn.bunny.dao.entity.system.EmailUsers; @@ -33,14 +33,14 @@ public class EmailFactory { */ public void sendEmailTemplate(String email, EmailTemplate emailTemplate, HashMap params) { // 判断邮件模板是否为空 - if (emailTemplate == null) throw new BunnyException(ResultCodeEnum.EMAIL_TEMPLATE_IS_EMPTY); + if (emailTemplate == null) throw new AuthCustomerException(ResultCodeEnum.EMAIL_TEMPLATE_IS_EMPTY); // 查询配置发送邮箱,如果没有配置发件者邮箱改用用户列表中默认的,如果默认的也为空则报错 Long emailUser = emailTemplate.getEmailUser(); EmailUsers emailUsers; if (emailUser == null) { emailUsers = emailUsersMapper.selectOne(Wrappers.lambdaQuery().eq(EmailUsers::getIsDefault, true)); - if (emailUsers == null) throw new BunnyException(ResultCodeEnum.EMAIL_USER_IS_EMPTY); + if (emailUsers == null) throw new AuthCustomerException(ResultCodeEnum.EMAIL_USER_IS_EMPTY); } else { emailUsers = emailUsersMapper.selectOne(Wrappers.lambdaQuery().eq(EmailUsers::getId, emailUser)); } @@ -66,7 +66,7 @@ public class EmailFactory { emailSend.setText(modifiedTemplate[0]); MailSenderUtil.sendEmail(emailSendInit, emailSend); } catch (MessagingException e) { - throw new BunnyException(ResultCodeEnum.SEND_MAIL_CODE_ERROR); + throw new AuthCustomerException(ResultCodeEnum.SEND_MAIL_CODE_ERROR); } } diff --git a/service/src/main/java/cn/bunny/services/mapper/financial/BillMapper.java b/service/src/main/java/cn/bunny/services/mapper/financial/BillMapper.java index 6a7e4a2..05f17cf 100644 --- a/service/src/main/java/cn/bunny/services/mapper/financial/BillMapper.java +++ b/service/src/main/java/cn/bunny/services/mapper/financial/BillMapper.java @@ -1,7 +1,7 @@ package cn.bunny.services.mapper.financial; import cn.bunny.dao.dto.financial.bill.BillDto; -import cn.bunny.dao.dto.financial.bill.ExpendWithIncomeDto; +import cn.bunny.dao.dto.financial.bill.IncomeExpenseQueryDto; import cn.bunny.dao.entity.financial.Bill; import cn.bunny.dao.vo.financial.admin.BillVo; import cn.bunny.dao.vo.financial.user.expendAndIncome.ExpendWithIncome; @@ -46,5 +46,5 @@ public interface BillMapper extends BaseMapper { * @param dto 请求表单 * @return 账单收入和支出 */ - List selectListByExpendWithIncomeDto(@Param("dto") ExpendWithIncomeDto dto); + List selectListByExpendWithIncomeDto(@Param("dto") IncomeExpenseQueryDto dto); } diff --git a/service/src/main/java/cn/bunny/services/security/service/impl/CustomUserDetailsServiceImpl.java b/service/src/main/java/cn/bunny/services/security/service/impl/CustomUserDetailsServiceImpl.java index bfcd702..607cf19 100644 --- a/service/src/main/java/cn/bunny/services/security/service/impl/CustomUserDetailsServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/security/service/impl/CustomUserDetailsServiceImpl.java @@ -1,6 +1,6 @@ package cn.bunny.services.security.service.impl; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.system.user.LoginDto; import cn.bunny.dao.entity.system.AdminUser; import cn.bunny.dao.pojo.result.Result; @@ -78,7 +78,7 @@ public class CustomUserDetailsServiceImpl implements cn.bunny.services.security. // 对登录密码进行md5加密判断,是否与数据库中一致 String md5Password = DigestUtils.md5DigestAsHex(password.getBytes()); - if (!user.getPassword().equals(md5Password)) throw new BunnyException(ResultCodeEnum.LOGIN_ERROR); + if (!user.getPassword().equals(md5Password)) throw new AuthCustomerException(ResultCodeEnum.LOGIN_ERROR); return userFactory.buildLoginUserVo(user, readMeDay); } diff --git a/service/src/main/java/cn/bunny/services/service/configuration/impl/ConfigurationServiceImpl.java b/service/src/main/java/cn/bunny/services/service/configuration/impl/ConfigurationServiceImpl.java index 2dda29e..bd153bf 100644 --- a/service/src/main/java/cn/bunny/services/service/configuration/impl/ConfigurationServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/configuration/impl/ConfigurationServiceImpl.java @@ -1,6 +1,6 @@ package cn.bunny.services.service.configuration.impl; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.system.configuration.WebConfigurationDto; import cn.bunny.dao.entity.configuration.WebConfiguration; import cn.bunny.dao.pojo.result.ResultCodeEnum; @@ -26,7 +26,7 @@ public class ConfigurationServiceImpl implements ConfigurationService { private String bashPath; private static @NotNull String getWebConfigString(InputStream inputStream, Path templatePath) throws IOException { - if (inputStream == null) throw new BunnyException(ResultCodeEnum.MISSING_TEMPLATE_FILES); + if (inputStream == null) throw new AuthCustomerException(ResultCodeEnum.MISSING_TEMPLATE_FILES); // 判断web模板文件是否存在,不存在进行复制 boolean exists = Files.exists(templatePath); @@ -80,7 +80,7 @@ public class ConfigurationServiceImpl implements ConfigurationService { String string = getWebConfigString(inputStream, templatePath); return JSON.parseObject(string, WebConfiguration.class); } catch (IOException exception) { - throw new BunnyException(exception.getMessage()); + throw new AuthCustomerException(exception.getMessage()); } } @@ -98,7 +98,7 @@ public class ConfigurationServiceImpl implements ConfigurationService { String string = getWebConfigString(inputStream, templatePath); return JSON.parseObject(string, WebConfigurationVo.class); } catch (IOException exception) { - throw new BunnyException(exception.getMessage()); + throw new AuthCustomerException(exception.getMessage()); } } } diff --git a/service/src/main/java/cn/bunny/services/service/configuration/impl/MenuIconServiceImpl.java b/service/src/main/java/cn/bunny/services/service/configuration/impl/MenuIconServiceImpl.java index a5a2cf5..fcf5a2a 100644 --- a/service/src/main/java/cn/bunny/services/service/configuration/impl/MenuIconServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/configuration/impl/MenuIconServiceImpl.java @@ -1,6 +1,6 @@ package cn.bunny.services.service.configuration.impl; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.system.menuIcon.MenuIconAddDto; import cn.bunny.dao.dto.system.menuIcon.MenuIconDto; import cn.bunny.dao.dto.system.menuIcon.MenuIconUpdateDto; @@ -105,7 +105,7 @@ public class MenuIconServiceImpl extends ServiceImpl i @CacheEvict(cacheNames = "menuIcon", key = "'menuIconList'", beforeInvocation = true) public void deleteMenuIcon(List ids) { // 判断数据请求是否为空 - if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (ids.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); baseMapper.deleteBatchIdsWithPhysics(ids); } diff --git a/service/src/main/java/cn/bunny/services/service/email/impl/EmailTemplateServiceImpl.java b/service/src/main/java/cn/bunny/services/service/email/impl/EmailTemplateServiceImpl.java index abbe244..0826fb5 100644 --- a/service/src/main/java/cn/bunny/services/service/email/impl/EmailTemplateServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/email/impl/EmailTemplateServiceImpl.java @@ -1,6 +1,6 @@ package cn.bunny.services.service.email.impl; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.system.email.template.EmailTemplateAddDto; import cn.bunny.dao.dto.system.email.template.EmailTemplateDto; import cn.bunny.dao.dto.system.email.template.EmailTemplateUpdateDto; @@ -76,7 +76,7 @@ public class EmailTemplateServiceImpl extends ServiceImpl emailTemplateList = list(Wrappers.lambdaQuery().eq(EmailTemplate::getId, dto.getId())); - if (emailTemplateList.isEmpty()) throw new BunnyException(ResultCodeEnum.DATA_NOT_EXIST); + if (emailTemplateList.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.DATA_NOT_EXIST); // 更新内容 EmailTemplate emailTemplate = new EmailTemplate(); @@ -92,7 +92,7 @@ public class EmailTemplateServiceImpl extends ServiceImpl ids) { // 判断数据请求是否为空 - if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (ids.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); baseMapper.deleteBatchIdsWithPhysics(ids); } diff --git a/service/src/main/java/cn/bunny/services/service/email/impl/EmailUsersServiceImpl.java b/service/src/main/java/cn/bunny/services/service/email/impl/EmailUsersServiceImpl.java index 9cd8cdd..3062d90 100644 --- a/service/src/main/java/cn/bunny/services/service/email/impl/EmailUsersServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/email/impl/EmailUsersServiceImpl.java @@ -1,6 +1,6 @@ package cn.bunny.services.service.email.impl; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.system.email.user.EmailUserUpdateStatusDto; import cn.bunny.dao.dto.system.email.user.EmailUsersAddDto; import cn.bunny.dao.dto.system.email.user.EmailUsersDto; @@ -100,7 +100,7 @@ public class EmailUsersServiceImpl extends ServiceImpl ids) { // 判断数据请求是否为空 - if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (ids.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); baseMapper.deleteBatchIdsWithPhysics(ids); } diff --git a/service/src/main/java/cn/bunny/services/service/financial/BillService.java b/service/src/main/java/cn/bunny/services/service/financial/BillService.java index af57259..b30e44e 100644 --- a/service/src/main/java/cn/bunny/services/service/financial/BillService.java +++ b/service/src/main/java/cn/bunny/services/service/financial/BillService.java @@ -1,12 +1,12 @@ package cn.bunny.services.service.financial; import cn.bunny.dao.dto.financial.bill.BillDto; -import cn.bunny.dao.dto.financial.bill.ExpendWithIncomeDto; +import cn.bunny.dao.dto.financial.bill.IncomeExpenseQueryDto; import cn.bunny.dao.dto.financial.bill.admin.BillAddDto; import cn.bunny.dao.dto.financial.bill.admin.BillUpdateDto; import cn.bunny.dao.dto.financial.bill.excel.BillExportDto; -import cn.bunny.dao.dto.financial.bill.user.BillAddUserDto; -import cn.bunny.dao.dto.financial.bill.user.BillUpdateUserDto; +import cn.bunny.dao.dto.financial.bill.user.BillAddByUserDto; +import cn.bunny.dao.dto.financial.bill.user.BillUpdateByUserDto; import cn.bunny.dao.entity.financial.Bill; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.vo.financial.admin.BillVo; @@ -76,14 +76,14 @@ public interface BillService extends IService { * * @param dto 添加表单 */ - void addUserBill(BillAddUserDto dto); + void addUserBill(BillAddByUserDto dto); /** * 用户更新账单信息 * * @param dto 更新表单 */ - void updateUserBill(BillUpdateUserDto dto); + void updateUserBill(BillUpdateByUserDto dto); /** * 账单收入和支出 @@ -91,7 +91,7 @@ public interface BillService extends IService { * @param dto 请求表单 * @return 账单收入和支出 */ - ExpendWithIncomeListVo getExpendOrIncome(ExpendWithIncomeDto dto); + ExpendWithIncomeListVo getExpendOrIncome(IncomeExpenseQueryDto dto); /** * 导出用户账单 diff --git a/service/src/main/java/cn/bunny/services/service/financial/BudgetCategoryService.java b/service/src/main/java/cn/bunny/services/service/financial/BudgetCategoryService.java index dd62536..09626ad 100644 --- a/service/src/main/java/cn/bunny/services/service/financial/BudgetCategoryService.java +++ b/service/src/main/java/cn/bunny/services/service/financial/BudgetCategoryService.java @@ -3,8 +3,8 @@ package cn.bunny.services.service.financial; import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryDto; import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryAddDto; import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryUpdateDto; -import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddUserDto; -import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryUpdateUserDto; +import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddByUserDto; +import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryUpdateByUserDto; import cn.bunny.dao.entity.financial.BudgetCategory; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.vo.financial.BudgetCategoryParentVo; @@ -89,12 +89,12 @@ public interface BudgetCategoryService extends IService { * * @param dto 添加表单 */ - void addUserBudgetCategory(BudgetCategoryAddUserDto dto); + void addUserBudgetCategory(BudgetCategoryAddByUserDto dto); /** * 用户更新预算分类表 * * @param dto 更新表单 */ - void updateUserBudgetCategory(BudgetCategoryUpdateUserDto dto); + void updateUserBudgetCategory(BudgetCategoryUpdateByUserDto dto); } diff --git a/service/src/main/java/cn/bunny/services/service/financial/CategoryService.java b/service/src/main/java/cn/bunny/services/service/financial/CategoryService.java index 557fa98..d01b577 100644 --- a/service/src/main/java/cn/bunny/services/service/financial/CategoryService.java +++ b/service/src/main/java/cn/bunny/services/service/financial/CategoryService.java @@ -2,9 +2,8 @@ package cn.bunny.services.service.financial; import cn.bunny.dao.dto.financial.category.CategoryDto; import cn.bunny.dao.dto.financial.category.admin.CategoryAddDto; -import cn.bunny.dao.dto.financial.category.admin.CategoryUpdateDto; -import cn.bunny.dao.dto.financial.category.user.CategoryUserAddDto; -import cn.bunny.dao.dto.financial.category.user.CategoryUserUpdateDto; +import cn.bunny.dao.dto.financial.category.user.CategoryAddByUserDto; +import cn.bunny.dao.dto.financial.category.user.CategoryUpdateByUserDto; import cn.bunny.dao.entity.financial.Category; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.vo.financial.admin.CategoryVo; @@ -58,21 +57,21 @@ public interface CategoryService extends IService { * * @param dto 添加表单 */ - void addCategoryUser(@Valid CategoryUserAddDto dto); + void addCategoryUser(@Valid CategoryAddByUserDto dto); /** * * 更新分类信息 * * @param dto 更新表单 */ - void updateCategory(@Valid CategoryUpdateDto dto); + void updateCategory(@Valid cn.bunny.dao.dto.financial.category.admin.CategoryUpdateDto dto); /** * * 用户分类更新分类信息 * * @param dto 更新表单 */ - void updateCategoryUser(@Valid CategoryUserUpdateDto dto); + void updateCategoryUser(@Valid CategoryUpdateByUserDto dto); /** * * 用户分类删除分类信息|批量删除分类信息类型 diff --git a/service/src/main/java/cn/bunny/services/service/financial/DebtRepaymentPlanService.java b/service/src/main/java/cn/bunny/services/service/financial/DebtRepaymentPlanService.java index 5cdb846..7a89eca 100644 --- a/service/src/main/java/cn/bunny/services/service/financial/DebtRepaymentPlanService.java +++ b/service/src/main/java/cn/bunny/services/service/financial/DebtRepaymentPlanService.java @@ -3,8 +3,8 @@ package cn.bunny.services.service.financial; import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanDto; import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanAddDto; import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanUpdateDto; -import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanAddUserDto; -import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanUpdateUserDto; +import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanAddByUserDto; +import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanUpdateByUserDto; import cn.bunny.dao.entity.financial.DebtRepaymentPlan; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.vo.financial.admin.DebtRepaymentPlanVo; @@ -67,14 +67,14 @@ public interface DebtRepaymentPlanService extends IService { * * @param dto 添加表单 */ - void addUserDebtRepaymentPlan(@Valid DebtRepaymentPlanAddUserDto dto); + void addUserDebtRepaymentPlan(@Valid DebtRepaymentPlanAddByUserDto dto); /** * 用户更新债务还款计划表 * * @param dto 更新表单 */ - void updateUserDebtRepaymentPlan(@Valid DebtRepaymentPlanUpdateUserDto dto); + void updateUserDebtRepaymentPlan(@Valid DebtRepaymentPlanUpdateByUserDto dto); /** * 用户删除债务还款计划表 diff --git a/service/src/main/java/cn/bunny/services/service/financial/DebtTrackingService.java b/service/src/main/java/cn/bunny/services/service/financial/DebtTrackingService.java index 5e67ab7..e4669f0 100644 --- a/service/src/main/java/cn/bunny/services/service/financial/DebtTrackingService.java +++ b/service/src/main/java/cn/bunny/services/service/financial/DebtTrackingService.java @@ -3,8 +3,8 @@ package cn.bunny.services.service.financial; import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingDto; import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingAddDto; import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingUpdateDto; -import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingAddUserDto; -import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingUpdateUserDto; +import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingAddByUserDto; +import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingUpdateByUserDto; import cn.bunny.dao.entity.financial.DebtTracking; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.vo.financial.admin.DebtTrackingVo; @@ -67,14 +67,14 @@ public interface DebtTrackingService extends IService { * * @param dto 添加表单 */ - void addUserDebtTracking(DebtTrackingAddUserDto dto); + void addUserDebtTracking(DebtTrackingAddByUserDto dto); /** * 用户更新债务追踪 * * @param dto 更新表单 */ - void updateUserDebtTracking(DebtTrackingUpdateUserDto dto); + void updateUserDebtTracking(DebtTrackingUpdateByUserDto dto); /** * 用户删除债务追踪 diff --git a/service/src/main/java/cn/bunny/services/service/financial/SavingGoalService.java b/service/src/main/java/cn/bunny/services/service/financial/SavingGoalService.java index 38c23cb..89ba999 100644 --- a/service/src/main/java/cn/bunny/services/service/financial/SavingGoalService.java +++ b/service/src/main/java/cn/bunny/services/service/financial/SavingGoalService.java @@ -3,8 +3,8 @@ package cn.bunny.services.service.financial; import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto; import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalAddDto; import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalUpdateDto; -import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalAddUserDto; -import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalUpdateUserDto; +import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalAddByUserDto; +import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalUpdateByUserDto; import cn.bunny.dao.entity.financial.SavingGoal; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.vo.financial.admin.SavingGoalVo; @@ -67,14 +67,14 @@ public interface SavingGoalService extends IService { * * @param dto 添加表单 */ - void adduserSavingGoal(@Valid SavingGoalAddUserDto dto); + void adduserSavingGoal(@Valid SavingGoalAddByUserDto dto); /** * 用户更新储值 * * @param dto 更新表单 */ - void updateUserSavingGoal(@Valid SavingGoalUpdateUserDto dto); + void updateUserSavingGoal(@Valid SavingGoalUpdateByUserDto dto); /** * 用户删除储值 diff --git a/service/src/main/java/cn/bunny/services/service/financial/impl/BillServiceImpl.java b/service/src/main/java/cn/bunny/services/service/financial/impl/BillServiceImpl.java index 47d5816..abf75b6 100644 --- a/service/src/main/java/cn/bunny/services/service/financial/impl/BillServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/financial/impl/BillServiceImpl.java @@ -1,15 +1,15 @@ package cn.bunny.services.service.financial.impl; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.financial.bill.BillDto; -import cn.bunny.dao.dto.financial.bill.ExpendWithIncomeDto; +import cn.bunny.dao.dto.financial.bill.IncomeExpenseQueryDto; import cn.bunny.dao.dto.financial.bill.admin.BillAddDto; import cn.bunny.dao.dto.financial.bill.admin.BillUpdateDto; import cn.bunny.dao.dto.financial.bill.excel.BillExportDto; -import cn.bunny.dao.dto.financial.bill.excel.BillImportUserDto; -import cn.bunny.dao.dto.financial.bill.user.BillAddUserDto; -import cn.bunny.dao.dto.financial.bill.user.BillUpdateUserDto; +import cn.bunny.dao.dto.financial.bill.excel.BillImportByUserDto; +import cn.bunny.dao.dto.financial.bill.user.BillAddByUserDto; +import cn.bunny.dao.dto.financial.bill.user.BillUpdateByUserDto; import cn.bunny.dao.entity.financial.Bill; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.pojo.result.ResultCodeEnum; @@ -162,7 +162,7 @@ public class BillServiceImpl extends ServiceImpl implements Bi * @param dto 添加表单 */ @Override - public void addUserBill(BillAddUserDto dto) { + public void addUserBill(BillAddByUserDto dto) { // 保存数据 Bill bill = new Bill(); BeanUtils.copyProperties(dto, bill); @@ -177,7 +177,7 @@ public class BillServiceImpl extends ServiceImpl implements Bi * @param dto 更新表单 */ @Override - public void updateUserBill(BillUpdateUserDto dto) { + public void updateUserBill(BillUpdateByUserDto dto) { // 更新内容 Bill bill = new Bill(); BeanUtils.copyProperties(dto, bill); @@ -193,7 +193,7 @@ public class BillServiceImpl extends ServiceImpl implements Bi * @return 账单收入和支出 */ @Override - public ExpendWithIncomeListVo getExpendOrIncome(ExpendWithIncomeDto dto) { + public ExpendWithIncomeListVo getExpendOrIncome(IncomeExpenseQueryDto dto) { // 查询时候多加一天,就可以查询到最后一个日期到晚上的数据 dto.setEndDate(dto.getEndDate().plusDays(1)); @@ -261,9 +261,9 @@ public class BillServiceImpl extends ServiceImpl implements Bi @Override public void importBill(MultipartFile file) { try { - EasyExcel.read(file.getInputStream(), BillImportUserDto.class, new BillAddUserListener(categoryMapper, messageMapper, messageReceivedMapper, this)).sheet().doRead(); + EasyExcel.read(file.getInputStream(), BillImportByUserDto.class, new BillAddUserListener(categoryMapper, messageMapper, messageReceivedMapper, this)).sheet().doRead(); } catch (IOException e) { - throw new BunnyException(ResultCodeEnum.UPDATE_ERROR); + throw new AuthCustomerException(ResultCodeEnum.UPDATE_ERROR); } } @@ -278,7 +278,7 @@ public class BillServiceImpl extends ServiceImpl implements Bi List billList = list(Wrappers.lambdaQuery().in(Bill::getId, ids)) .stream().filter(bill -> !bill.getUserId().equals(BaseContext.getUserId())).toList(); if (!billList.isEmpty()) { - throw new BunnyException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); + throw new AuthCustomerException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); } baseMapper.deleteBatchIdsWithPhysics(ids); } diff --git a/service/src/main/java/cn/bunny/services/service/financial/impl/BudgetCategoryServiceImpl.java b/service/src/main/java/cn/bunny/services/service/financial/impl/BudgetCategoryServiceImpl.java index 41477b7..de6f487 100644 --- a/service/src/main/java/cn/bunny/services/service/financial/impl/BudgetCategoryServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/financial/impl/BudgetCategoryServiceImpl.java @@ -1,12 +1,12 @@ package cn.bunny.services.service.financial.impl; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.financial.budgetCategory.BudgetCategoryDto; import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryAddDto; import cn.bunny.dao.dto.financial.budgetCategory.admin.BudgetCategoryUpdateDto; -import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddUserDto; -import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryUpdateUserDto; +import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryAddByUserDto; +import cn.bunny.dao.dto.financial.budgetCategory.user.BudgetCategoryUpdateByUserDto; import cn.bunny.dao.entity.financial.BudgetCategory; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.pojo.result.ResultCodeEnum; @@ -148,7 +148,7 @@ public class BudgetCategoryServiceImpl extends ServiceImpl billList = list(Wrappers.lambdaQuery().in(BudgetCategory::getId, ids)) .stream().filter(bill -> !bill.getUserId().equals(BaseContext.getUserId())).toList(); if (!billList.isEmpty()) { - throw new BunnyException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); + throw new AuthCustomerException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); } baseMapper.deleteBatchIdsWithPhysics(ids); @@ -175,7 +175,7 @@ public class BudgetCategoryServiceImpl extends ServiceImpl i * @param dto 分类信息添加 */ @Override - public void addCategoryUser(@Valid CategoryUserAddDto dto) { + public void addCategoryUser(@Valid CategoryAddByUserDto dto) { // 查询当前用户添加了多少条 if (count(Wrappers.lambdaQuery().eq(Category::getIsBuiltin, false)) >= UserConstant.CATEGORY_COUNT) { - throw new BunnyException(ResultCodeEnum.THE_MAXIMUM_BAR_CODE); + throw new AuthCustomerException(ResultCodeEnum.THE_MAXIMUM_BAR_CODE); } // 保存数据 @@ -152,7 +151,7 @@ public class CategoryServiceImpl extends ServiceImpl i * @param dto 分类信息更新 */ @Override - public void updateCategory(@Valid CategoryUpdateDto dto) { + public void updateCategory(@Valid cn.bunny.dao.dto.financial.category.admin.CategoryUpdateDto dto) { // 更新内容 Category category = new Category(); BeanUtils.copyProperties(dto, category); @@ -165,7 +164,7 @@ public class CategoryServiceImpl extends ServiceImpl i * @param dto 分类信息更新 */ @Override - public void updateCategoryUser(@Valid CategoryUserUpdateDto dto) { + public void updateCategoryUser(@Valid CategoryUpdateByUserDto dto) { Long userId = BaseContext.getUserId(); // 判断用户修改的当前内容是否和系统内置的信息一致 @@ -173,7 +172,7 @@ public class CategoryServiceImpl extends ServiceImpl i Long categoryUserId = category.getUserId(); if (!categoryUserId.equals(userId)) { - throw new BunnyException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); + throw new AuthCustomerException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); } // 更新内容 diff --git a/service/src/main/java/cn/bunny/services/service/financial/impl/DebtRepaymentPlanServiceImpl.java b/service/src/main/java/cn/bunny/services/service/financial/impl/DebtRepaymentPlanServiceImpl.java index f159b1c..6c931ac 100644 --- a/service/src/main/java/cn/bunny/services/service/financial/impl/DebtRepaymentPlanServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/financial/impl/DebtRepaymentPlanServiceImpl.java @@ -1,12 +1,12 @@ package cn.bunny.services.service.financial.impl; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.financial.debtRepaymentPlan.DebtRepaymentPlanDto; import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanAddDto; import cn.bunny.dao.dto.financial.debtRepaymentPlan.admin.DebtRepaymentPlanUpdateDto; -import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanAddUserDto; -import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanUpdateUserDto; +import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanAddByUserDto; +import cn.bunny.dao.dto.financial.debtRepaymentPlan.user.DebtRepaymentPlanUpdateByUserDto; import cn.bunny.dao.entity.financial.DebtRepaymentPlan; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.pojo.result.ResultCodeEnum; @@ -122,7 +122,7 @@ public class DebtRepaymentPlanServiceImpl extends ServiceImpl billList = list(Wrappers.lambdaQuery().in(DebtRepaymentPlan::getId, ids)) .stream().filter(bill -> !bill.getUserId().equals(BaseContext.getUserId())).toList(); if (!billList.isEmpty()) { - throw new BunnyException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); + throw new AuthCustomerException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); } baseMapper.deleteBatchIdsWithPhysics(ids); diff --git a/service/src/main/java/cn/bunny/services/service/financial/impl/DebtTrackingServiceImpl.java b/service/src/main/java/cn/bunny/services/service/financial/impl/DebtTrackingServiceImpl.java index dbc9974..2e43119 100644 --- a/service/src/main/java/cn/bunny/services/service/financial/impl/DebtTrackingServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/financial/impl/DebtTrackingServiceImpl.java @@ -1,12 +1,12 @@ package cn.bunny.services.service.financial.impl; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.financial.debtTracking.DebtTrackingDto; import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingAddDto; import cn.bunny.dao.dto.financial.debtTracking.admin.DebtTrackingUpdateDto; -import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingAddUserDto; -import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingUpdateUserDto; +import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingAddByUserDto; +import cn.bunny.dao.dto.financial.debtTracking.user.DebtTrackingUpdateByUserDto; import cn.bunny.dao.entity.financial.DebtTracking; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.pojo.result.ResultCodeEnum; @@ -123,7 +123,7 @@ public class DebtTrackingServiceImpl extends ServiceImpl billList = list(Wrappers.lambdaQuery().in(DebtTracking::getId, ids)) .stream().filter(bill -> !bill.getUserId().equals(BaseContext.getUserId())).toList(); if (!billList.isEmpty()) { - throw new BunnyException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); + throw new AuthCustomerException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); } baseMapper.deleteBatchIdsWithPhysics(ids); diff --git a/service/src/main/java/cn/bunny/services/service/financial/impl/SavingGoalServiceImpl.java b/service/src/main/java/cn/bunny/services/service/financial/impl/SavingGoalServiceImpl.java index 3429216..df3a1d5 100644 --- a/service/src/main/java/cn/bunny/services/service/financial/impl/SavingGoalServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/financial/impl/SavingGoalServiceImpl.java @@ -1,12 +1,12 @@ package cn.bunny.services.service.financial.impl; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.financial.savingGoal.SavingGoalDto; import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalAddDto; import cn.bunny.dao.dto.financial.savingGoal.admin.SavingGoalUpdateDto; -import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalAddUserDto; -import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalUpdateUserDto; +import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalAddByUserDto; +import cn.bunny.dao.dto.financial.savingGoal.user.SavingGoalUpdateByUserDto; import cn.bunny.dao.entity.financial.SavingGoal; import cn.bunny.dao.pojo.result.PageResult; import cn.bunny.dao.pojo.result.ResultCodeEnum; @@ -133,7 +133,7 @@ public class SavingGoalServiceImpl extends ServiceImpl billList = list(Wrappers.lambdaQuery().in(SavingGoal::getId, ids)) .stream().filter(bill -> !bill.getUserId().equals(BaseContext.getUserId())).toList(); if (!billList.isEmpty()) { - throw new BunnyException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); + throw new AuthCustomerException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); } baseMapper.deleteBatchIdsWithPhysics(ids); diff --git a/service/src/main/java/cn/bunny/services/service/i18n/impl/I18nServiceImpl.java b/service/src/main/java/cn/bunny/services/service/i18n/impl/I18nServiceImpl.java index b8172af..62d62d4 100644 --- a/service/src/main/java/cn/bunny/services/service/i18n/impl/I18nServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/i18n/impl/I18nServiceImpl.java @@ -1,6 +1,6 @@ package cn.bunny.services.service.i18n.impl; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.i18n.I18nAddDto; import cn.bunny.dao.dto.i18n.I18nDto; import cn.bunny.dao.dto.i18n.I18nUpdateDto; @@ -99,7 +99,7 @@ public class I18nServiceImpl extends ServiceImpl implements I1 // 查询数据是否存在 List i18nList = list(Wrappers.lambdaQuery().eq(I18n::getKeyName, keyName).eq(I18n::getTypeName, typeName)); - if (!i18nList.isEmpty()) throw new BunnyException(ResultCodeEnum.DATA_EXIST); + if (!i18nList.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.DATA_EXIST); // 保存内容 I18n i18n = new I18n(); @@ -119,7 +119,7 @@ public class I18nServiceImpl extends ServiceImpl implements I1 // 查询数据是否存在 List i18nList = list(Wrappers.lambdaQuery().eq(I18n::getId, id)); - if (i18nList.isEmpty()) throw new BunnyException(ResultCodeEnum.DATA_NOT_EXIST); + if (i18nList.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.DATA_NOT_EXIST); // 保存内容 I18n i18n = new I18n(); @@ -136,7 +136,7 @@ public class I18nServiceImpl extends ServiceImpl implements I1 @CacheEvict(cacheNames = "i18n", key = "'i18n'", beforeInvocation = true) public void deleteI18n(List ids) { // 判断数据请求是否为空 - if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (ids.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); baseMapper.deleteBatchIdsWithPhysics(ids); } diff --git a/service/src/main/java/cn/bunny/services/service/i18n/impl/I18nTypeServiceImpl.java b/service/src/main/java/cn/bunny/services/service/i18n/impl/I18nTypeServiceImpl.java index 7385cb9..c15814a 100644 --- a/service/src/main/java/cn/bunny/services/service/i18n/impl/I18nTypeServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/i18n/impl/I18nTypeServiceImpl.java @@ -1,6 +1,6 @@ package cn.bunny.services.service.i18n.impl; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.i18n.I18nTypeAddDto; import cn.bunny.dao.dto.i18n.I18nTypeDto; import cn.bunny.dao.dto.i18n.I18nTypeUpdateDto; @@ -61,7 +61,7 @@ public class I18nTypeServiceImpl extends ServiceImpl i // 查询添加的数据是否之前添加过 List i18nTypeList = list(Wrappers.lambdaQuery().eq(I18nType::getTypeName, typeName)); - if (!i18nTypeList.isEmpty()) throw new BunnyException(ResultCodeEnum.DATA_EXIST); + if (!i18nTypeList.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.DATA_EXIST); // 如果是默认,将其它内容设为false if (isDefault) { @@ -89,7 +89,7 @@ public class I18nTypeServiceImpl extends ServiceImpl i // 查询更新的内容是否存在 List i18nTypeList = list(Wrappers.lambdaQuery().eq(I18nType::getId, id)); - if (i18nTypeList.isEmpty()) throw new BunnyException(ResultCodeEnum.DATA_NOT_EXIST); + if (i18nTypeList.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.DATA_NOT_EXIST); // 如果是默认,将其它内容设为false if (isDefault) { @@ -112,7 +112,7 @@ public class I18nTypeServiceImpl extends ServiceImpl i @CacheEvict(cacheNames = "i18n", key = "'i18nType'", beforeInvocation = true) public void deleteI18nType(List ids) { // 判断数据请求是否为空 - if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (ids.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); baseMapper.deleteBatchIdsWithPhysics(ids); } diff --git a/service/src/main/java/cn/bunny/services/service/index/impl/IndexServiceImpl.java b/service/src/main/java/cn/bunny/services/service/index/impl/IndexServiceImpl.java index 0364e49..bbb9580 100644 --- a/service/src/main/java/cn/bunny/services/service/index/impl/IndexServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/index/impl/IndexServiceImpl.java @@ -2,7 +2,7 @@ package cn.bunny.services.service.index.impl; import cn.bunny.common.service.context.BaseContext; import cn.bunny.dao.dto.financial.HomeDto; -import cn.bunny.dao.dto.financial.bill.ExpendWithIncomeDto; +import cn.bunny.dao.dto.financial.bill.IncomeExpenseQueryDto; import cn.bunny.dao.vo.financial.user.expendAndIncome.ExpendWithIncome; import cn.bunny.dao.vo.financial.user.home.CountTop; import cn.bunny.dao.vo.financial.user.home.HomeVo; @@ -37,13 +37,13 @@ public class IndexServiceImpl implements IndexService { LocalDateTime endDate = dto.getEndDate().atStartOfDay(); // 设置查询dto - ExpendWithIncomeDto expendWithIncomeDto = new ExpendWithIncomeDto(); - expendWithIncomeDto.setUserId(BaseContext.getUserId()); - expendWithIncomeDto.setStartDate(startDate.toLocalDate()); - expendWithIncomeDto.setEndDate(endDate.toLocalDate().plusDays(1));// 查询时候多加一天,就可以查询到最后一个日期到晚上的数据 + IncomeExpenseQueryDto incomeExpenseQueryDto = new IncomeExpenseQueryDto(); + incomeExpenseQueryDto.setUserId(BaseContext.getUserId()); + incomeExpenseQueryDto.setStartDate(startDate.toLocalDate()); + incomeExpenseQueryDto.setEndDate(endDate.toLocalDate().plusDays(1));// 查询时候多加一天,就可以查询到最后一个日期到晚上的数据 // 查询收入和支出 - List homeRanks = billMapper.selectListByExpendWithIncomeDto(expendWithIncomeDto); + List homeRanks = billMapper.selectListByExpendWithIncomeDto(incomeExpenseQueryDto); // 主页卡片数据 Map homeCard = homeFactory.homeCard(homeRanks); diff --git a/service/src/main/java/cn/bunny/services/service/message/impl/MessageReceivedServiceImpl.java b/service/src/main/java/cn/bunny/services/service/message/impl/MessageReceivedServiceImpl.java index 2878b43..9c5584c 100644 --- a/service/src/main/java/cn/bunny/services/service/message/impl/MessageReceivedServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/message/impl/MessageReceivedServiceImpl.java @@ -1,7 +1,7 @@ package cn.bunny.services.service.message.impl; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.system.message.MessageReceivedDto; import cn.bunny.dao.dto.system.message.MessageReceivedUpdateDto; import cn.bunny.dao.dto.system.message.MessageUserDto; @@ -133,7 +133,7 @@ public class MessageReceivedServiceImpl extends ServiceImpl ids) { // 判断ids是否为空 if (ids.isEmpty()) { - throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); } // 更新表中消息状态 @@ -156,14 +156,14 @@ public class MessageReceivedServiceImpl extends ServiceImpl ids) { // 判断ids是否为空 if (ids.isEmpty()) { - throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); } // 判断删除的是否是自己的消息 List messageReceivedList = list(Wrappers.lambdaQuery().in(MessageReceived::getReceivedUserId, ids)); messageReceivedList.forEach(messageReceived -> { if (!messageReceived.getReceivedUserId().equals(BaseContext.getUserId())) { - throw new BunnyException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); + throw new AuthCustomerException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); } }); diff --git a/service/src/main/java/cn/bunny/services/service/message/impl/MessageServiceImpl.java b/service/src/main/java/cn/bunny/services/service/message/impl/MessageServiceImpl.java index 921a248..f51481d 100644 --- a/service/src/main/java/cn/bunny/services/service/message/impl/MessageServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/message/impl/MessageServiceImpl.java @@ -1,7 +1,7 @@ package cn.bunny.services.service.message.impl; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.common.entity.BaseEntity; import cn.bunny.dao.dto.system.message.MessageAddDto; import cn.bunny.dao.dto.system.message.MessageDto; @@ -131,7 +131,7 @@ public class MessageServiceImpl extends ServiceImpl impl @Override public List getReceivedUserinfoByMessageId(Long messageId) { if (messageId == null) { - throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); } return baseMapper.selectUserinfoListByMessageId(messageId); } diff --git a/service/src/main/java/cn/bunny/services/service/schedule/impl/SchedulersServiceImpl.java b/service/src/main/java/cn/bunny/services/service/schedule/impl/SchedulersServiceImpl.java index d118ba9..c09e90a 100644 --- a/service/src/main/java/cn/bunny/services/service/schedule/impl/SchedulersServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/schedule/impl/SchedulersServiceImpl.java @@ -1,6 +1,6 @@ package cn.bunny.services.service.schedule.impl; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.quartz.SchedulersOperationDto; import cn.bunny.dao.dto.quartz.schedule.SchedulersAddDto; import cn.bunny.dao.dto.quartz.schedule.SchedulersDto; @@ -134,7 +134,7 @@ public class SchedulersServiceImpl extends ServiceImpl implements De @Override @CacheEvict(cacheNames = "dept", key = "'allDept'", beforeInvocation = true) public void updateDept(DeptUpdateDto dto) { - if (dto.getId().equals(dto.getParentId())) throw new BunnyException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); + if (dto.getId().equals(dto.getParentId())) throw new AuthCustomerException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); // 将管理员用户逗号分隔 String mangerList = dto.getManager().stream().map(String::trim).collect(Collectors.joining(",")); @@ -122,7 +122,7 @@ public class DeptServiceImpl extends ServiceImpl implements De @CacheEvict(cacheNames = "dept", key = "'allDept'", beforeInvocation = true) public void deleteDept(List ids) { // 判断数据请求是否为空 - if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (ids.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); // 删除当前部门 baseMapper.deleteBatchIdsWithPhysics(ids); diff --git a/service/src/main/java/cn/bunny/services/service/system/impl/FilesServiceImpl.java b/service/src/main/java/cn/bunny/services/service/system/impl/FilesServiceImpl.java index 3b675aa..b2cfb92 100644 --- a/service/src/main/java/cn/bunny/services/service/system/impl/FilesServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/system/impl/FilesServiceImpl.java @@ -1,7 +1,7 @@ package cn.bunny.services.service.system.impl; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.common.service.utils.FileUtil; import cn.bunny.common.service.utils.minio.MinioProperties; import cn.bunny.common.service.utils.minio.MinioUtil; @@ -112,7 +112,7 @@ public class FilesServiceImpl extends ServiceImpl implements files.setDownloadCount(dto.getDownloadCount()); return files; } catch (IOException e) { - throw new BunnyException(e.getMessage()); + throw new AuthCustomerException(e.getMessage()); } }).toList(); @@ -175,7 +175,7 @@ public class FilesServiceImpl extends ServiceImpl implements // 盘读研数据是否过大 String mb = maxFileSize.replace("MB", ""); - if (fileSize / 1024 / 1024 > Long.parseLong(mb)) throw new BunnyException(ResultCodeEnum.DATA_TOO_LARGE); + if (fileSize / 1024 / 1024 > Long.parseLong(mb)) throw new AuthCustomerException(ResultCodeEnum.DATA_TOO_LARGE); // 插入文件信息 Files adminFiles = new Files(); @@ -204,7 +204,7 @@ public class FilesServiceImpl extends ServiceImpl implements */ @Override public void deleteFiles(List ids) { - if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (ids.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); // 查询文件路径 List list = list(Wrappers.lambdaQuery().in(Files::getId, ids)).stream() @@ -233,7 +233,7 @@ public class FilesServiceImpl extends ServiceImpl implements Files files = getOne(Wrappers.lambdaQuery().eq(Files::getId, fileId)); // 判断文件是否存在 - if (files == null) throw new BunnyException(ResultCodeEnum.FILE_NOT_EXIST); + if (files == null) throw new AuthCustomerException(ResultCodeEnum.FILE_NOT_EXIST); // 从Minio获取文件 String filepath = files.getFilepath(); @@ -313,7 +313,7 @@ public class FilesServiceImpl extends ServiceImpl implements List categoryList = categoryMapper.selectList(queryWrapper); String filenameTemplate = Objects.requireNonNull(getClass().getResource("/static/bill-add-template.xlsx")).getFile(); - if (filenameTemplate == null) throw new BunnyException(ResultCodeEnum.MISSING_TEMPLATE_FILES); + if (filenameTemplate == null) throw new AuthCustomerException(ResultCodeEnum.MISSING_TEMPLATE_FILES); try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(filenameTemplate).build()) { // 填充数据,类型数据要填充的在第二个sheet diff --git a/service/src/main/java/cn/bunny/services/service/system/impl/PowerServiceImpl.java b/service/src/main/java/cn/bunny/services/service/system/impl/PowerServiceImpl.java index 8b250e2..0afd452 100644 --- a/service/src/main/java/cn/bunny/services/service/system/impl/PowerServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/system/impl/PowerServiceImpl.java @@ -1,6 +1,6 @@ package cn.bunny.services.service.system.impl; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.system.rolePower.power.PowerAddDto; import cn.bunny.dao.dto.system.rolePower.power.PowerDto; import cn.bunny.dao.dto.system.rolePower.power.PowerUpdateBatchByParentIdDto; @@ -91,7 +91,7 @@ public class PowerServiceImpl extends ServiceImpl implements .or() .eq(Power::getRequestUrl, dto.getRequestUrl()); List powerList = list(wrapper); - if (!powerList.isEmpty()) throw new BunnyException(ResultCodeEnum.DATA_EXIST); + if (!powerList.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.DATA_EXIST); // 保存数据 Power power = new Power(); @@ -109,8 +109,8 @@ public class PowerServiceImpl extends ServiceImpl implements public void updatePower(@Valid PowerUpdateDto dto) { Long id = dto.getId(); List powerList = list(Wrappers.lambdaQuery().eq(Power::getId, id)); - if (powerList.isEmpty()) throw new BunnyException(ResultCodeEnum.DATA_NOT_EXIST); - if (dto.getId().equals(dto.getParentId())) throw new BunnyException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); + if (powerList.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.DATA_NOT_EXIST); + if (dto.getId().equals(dto.getParentId())) throw new AuthCustomerException(ResultCodeEnum.ILLEGAL_DATA_REQUEST); // 更新内容 Power power = new Power(); @@ -127,7 +127,7 @@ public class PowerServiceImpl extends ServiceImpl implements @CacheEvict(cacheNames = "power", key = "'allPower'", beforeInvocation = true) public void deletePower(List ids) { // 判断数据请求是否为空 - if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (ids.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); // 删除权限 baseMapper.deleteBatchIdsWithPhysics(ids); diff --git a/service/src/main/java/cn/bunny/services/service/system/impl/RoleServiceImpl.java b/service/src/main/java/cn/bunny/services/service/system/impl/RoleServiceImpl.java index fa8955b..6a11ba6 100644 --- a/service/src/main/java/cn/bunny/services/service/system/impl/RoleServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/system/impl/RoleServiceImpl.java @@ -1,6 +1,6 @@ package cn.bunny.services.service.system.impl; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.system.rolePower.role.RoleAddDto; import cn.bunny.dao.dto.system.rolePower.role.RoleDto; import cn.bunny.dao.dto.system.rolePower.role.RoleUpdateDto; @@ -108,7 +108,7 @@ public class RoleServiceImpl extends ServiceImpl implements Ro public void updateRole(@Valid RoleUpdateDto dto) { // 查询更新的角色是否存在 List roleList = list(Wrappers.lambdaQuery().eq(Role::getId, dto.getId())); - if (roleList.isEmpty()) throw new BunnyException(ResultCodeEnum.DATA_NOT_EXIST); + if (roleList.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.DATA_NOT_EXIST); // 更新内容 Role role = new Role(); @@ -131,7 +131,7 @@ public class RoleServiceImpl extends ServiceImpl implements Ro @CacheEvict(cacheNames = "role", key = "'allRole'", beforeInvocation = true) public void deleteRole(List ids) { // 判断数据请求是否为空 - if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (ids.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); // 删除角色 baseMapper.deleteBatchIdsWithPhysics(ids); diff --git a/service/src/main/java/cn/bunny/services/service/system/impl/RouterRoleServiceImpl.java b/service/src/main/java/cn/bunny/services/service/system/impl/RouterRoleServiceImpl.java index 2f2cc94..dd71af3 100644 --- a/service/src/main/java/cn/bunny/services/service/system/impl/RouterRoleServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/system/impl/RouterRoleServiceImpl.java @@ -1,6 +1,6 @@ package cn.bunny.services.service.system.impl; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.system.router.AssignRolesToRoutersDto; import cn.bunny.dao.entity.system.RouterRole; import cn.bunny.dao.pojo.result.ResultCodeEnum; @@ -76,7 +76,7 @@ public class RouterRoleServiceImpl extends ServiceImpl routerIds) { if (routerIds.isEmpty()) { - throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); } baseMapper.deleteBatchIdsByRouterIdsWithPhysics(routerIds); } diff --git a/service/src/main/java/cn/bunny/services/service/system/impl/RouterServiceImpl.java b/service/src/main/java/cn/bunny/services/service/system/impl/RouterServiceImpl.java index f4516e0..76cbe94 100644 --- a/service/src/main/java/cn/bunny/services/service/system/impl/RouterServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/system/impl/RouterServiceImpl.java @@ -1,7 +1,7 @@ package cn.bunny.services.service.system.impl; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.system.router.RouterAddDto; import cn.bunny.dao.dto.system.router.RouterManageDto; import cn.bunny.dao.dto.system.router.RouterUpdateByIdWithRankDto; @@ -222,7 +222,7 @@ public class RouterServiceImpl extends ServiceImpl impleme // 设置路由等级需要大于或等于父级的路由等级 if (routerParent != null && (dto.getRouterRank() < routerParent.getRouterRank())) { - throw new BunnyException(ResultCodeEnum.ROUTER_RANK_NEED_LARGER_THAN_THE_PARENT); + throw new AuthCustomerException(ResultCodeEnum.ROUTER_RANK_NEED_LARGER_THAN_THE_PARENT); } // 如果设置的不是外部页面 @@ -241,7 +241,7 @@ public class RouterServiceImpl extends ServiceImpl impleme @Override public void deletedMenuByIds(List ids) { // 判断数据请求是否为空 - if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (ids.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); // 查找子级菜单,一起删除 List longList = list(Wrappers.lambdaQuery().in(Router::getParentId, ids)).stream().map(Router::getId).toList(); @@ -264,14 +264,14 @@ public class RouterServiceImpl extends ServiceImpl impleme Router router = getOne(Wrappers.lambdaQuery().eq(Router::getId, dto.getId())); // 判断更新数据是否存在 - if (router == null) throw new BunnyException(ResultCodeEnum.DATA_NOT_EXIST); + if (router == null) throw new AuthCustomerException(ResultCodeEnum.DATA_NOT_EXIST); // 查询当前路由和父级路由 Router routerParent = getOne(Wrappers.lambdaQuery().eq(Router::getId, router.getParentId())); // 设置路由等级需要大于或等于父级的路由等级 if (routerParent != null && (dto.getRouterRank() < routerParent.getRouterRank())) { - throw new BunnyException(ResultCodeEnum.ROUTER_RANK_NEED_LARGER_THAN_THE_PARENT); + throw new AuthCustomerException(ResultCodeEnum.ROUTER_RANK_NEED_LARGER_THAN_THE_PARENT); } // 更新排序 diff --git a/service/src/main/java/cn/bunny/services/service/system/impl/UserRoleServiceImpl.java b/service/src/main/java/cn/bunny/services/service/system/impl/UserRoleServiceImpl.java index a958f9d..fac4560 100644 --- a/service/src/main/java/cn/bunny/services/service/system/impl/UserRoleServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/system/impl/UserRoleServiceImpl.java @@ -1,7 +1,7 @@ package cn.bunny.services.service.system.impl; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.dao.dto.system.user.AssignRolesToUsersDto; import cn.bunny.dao.entity.system.AdminUser; import cn.bunny.dao.entity.system.UserRole; @@ -54,7 +54,7 @@ public class UserRoleServiceImpl extends ServiceImpl i */ @Override public List getRoleListByUserId(Long userId) { - if (userId == null) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (userId == null) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); List userRoles = userRoleMapper.selectList(Wrappers.lambdaQuery().eq(UserRole::getUserId, userId)); return userRoles.stream().map(userRole -> userRole.getRoleId().toString()).toList(); @@ -73,7 +73,7 @@ public class UserRoleServiceImpl extends ServiceImpl i // 查询当前用户 AdminUser adminUser = userMapper.selectOne(Wrappers.lambdaQuery().eq(AdminUser::getId, userId)); if (adminUser == null) { - throw new BunnyException(ResultCodeEnum.USER_IS_EMPTY); + throw new AuthCustomerException(ResultCodeEnum.USER_IS_EMPTY); } // 删除这个用户下所有已经分配好的角色内容 diff --git a/service/src/main/java/cn/bunny/services/service/system/impl/UserServiceImpl.java b/service/src/main/java/cn/bunny/services/service/system/impl/UserServiceImpl.java index ba1efd3..e11c243 100644 --- a/service/src/main/java/cn/bunny/services/service/system/impl/UserServiceImpl.java +++ b/service/src/main/java/cn/bunny/services/service/system/impl/UserServiceImpl.java @@ -1,7 +1,7 @@ package cn.bunny.services.service.system.impl; import cn.bunny.common.service.context.BaseContext; -import cn.bunny.common.service.exception.BunnyException; +import cn.bunny.common.service.exception.AuthCustomerException; import cn.bunny.common.service.utils.JwtHelper; import cn.bunny.common.service.utils.ip.IpUtil; import cn.bunny.dao.dto.system.files.FileUploadDto; @@ -130,8 +130,8 @@ public class UserServiceImpl extends ServiceImpl implemen Long userId = JwtHelper.getUserId(dto.getRefreshToken()); AdminUser adminUser = getOne(Wrappers.lambdaQuery().eq(AdminUser::getId, userId)); - if (adminUser == null) throw new BunnyException(ResultCodeEnum.USER_IS_EMPTY); - if (adminUser.getStatus()) throw new BunnyException(ResultCodeEnum.FAIL_NO_ACCESS_DENIED_USER_LOCKED); + if (adminUser == null) throw new AuthCustomerException(ResultCodeEnum.USER_IS_EMPTY); + if (adminUser.getStatus()) throw new AuthCustomerException(ResultCodeEnum.FAIL_NO_ACCESS_DENIED_USER_LOCKED); LoginVo buildUserVo = userFactory.buildLoginUserVo(adminUser, dto.getReadMeDay()); RefreshTokenVo refreshTokenVo = new RefreshTokenVo(); @@ -172,11 +172,11 @@ public class UserServiceImpl extends ServiceImpl implemen @Override public UserVo getUserinfoById(Long id) { // 判断请求Id是否为空 - if (id == null) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (id == null) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); AdminUser user = getById(id); // 用户是否存在 - if (user == null) throw new BunnyException(ResultCodeEnum.DATA_NOT_EXIST); + if (user == null) throw new AuthCustomerException(ResultCodeEnum.DATA_NOT_EXIST); // 用户头像 String avatar = user.getAvatar(); @@ -202,11 +202,11 @@ public class UserServiceImpl extends ServiceImpl implemen AdminUser adminUser = getOne(Wrappers.lambdaQuery().eq(AdminUser::getId, userId)); // 判断是否存在这个用户 - if (adminUser == null) throw new BunnyException(ResultCodeEnum.USER_IS_EMPTY); + if (adminUser == null) throw new AuthCustomerException(ResultCodeEnum.USER_IS_EMPTY); // 判断新密码是否与旧密码相同 if (adminUser.getPassword().equals(md5Password)) - throw new BunnyException(ResultCodeEnum.UPDATE_NEW_PASSWORD_SAME_AS_OLD_PASSWORD); + throw new AuthCustomerException(ResultCodeEnum.UPDATE_NEW_PASSWORD_SAME_AS_OLD_PASSWORD); // 更新用户密码 adminUser = new AdminUser(); @@ -231,7 +231,7 @@ public class UserServiceImpl extends ServiceImpl implemen // 判断是否存在这个用户 AdminUser user = getOne(Wrappers.lambdaQuery().eq(AdminUser::getId, userId)); - if (user == null) throw new BunnyException(ResultCodeEnum.USER_IS_EMPTY); + if (user == null) throw new AuthCustomerException(ResultCodeEnum.USER_IS_EMPTY); // 上传头像 FileUploadDto uploadDto = FileUploadDto.builder().file(avatar).type(MinioConstant.avatar).build(); @@ -255,7 +255,7 @@ public class UserServiceImpl extends ServiceImpl implemen */ @Override public void forcedOffline(Long id) { - if (id == null) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (id == null) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); // 根据id查询用户登录前缀 AdminUser adminUser = getOne(Wrappers.lambdaQuery().eq(AdminUser::getId, id)); @@ -341,7 +341,7 @@ public class UserServiceImpl extends ServiceImpl implemen // 判断是否存在这个用户 AdminUser user = getOne(Wrappers.lambdaQuery().eq(AdminUser::getId, userId)); - if (user == null) throw new BunnyException(ResultCodeEnum.USER_IS_EMPTY); + if (user == null) throw new AuthCustomerException(ResultCodeEnum.USER_IS_EMPTY); // 检查用户头像 dto.setAvatar(userFactory.checkPostUserAvatar(dto.getAvatar())); @@ -369,14 +369,14 @@ public class UserServiceImpl extends ServiceImpl implemen AdminUser adminUser = getOne(Wrappers.lambdaQuery().eq(AdminUser::getId, userId)); // 判断用户是否存在 - if (adminUser == null) throw new BunnyException(ResultCodeEnum.USER_IS_EMPTY); + if (adminUser == null) throw new AuthCustomerException(ResultCodeEnum.USER_IS_EMPTY); // 数据库中的密码 String dbPassword = adminUser.getPassword(); password = DigestUtils.md5DigestAsHex(password.getBytes()); // 判断数据库中密码是否和更新用户密码相同 - if (dbPassword.equals(password)) throw new BunnyException(ResultCodeEnum.NEW_PASSWORD_SAME_OLD_PASSWORD); + if (dbPassword.equals(password)) throw new AuthCustomerException(ResultCodeEnum.NEW_PASSWORD_SAME_OLD_PASSWORD); // 更新用户密码 adminUser = new AdminUser(); @@ -463,7 +463,7 @@ public class UserServiceImpl extends ServiceImpl implemen // 判断更新内容是否存在 AdminUser adminUser = getOne(Wrappers.lambdaQuery().eq(AdminUser::getId, userId)); - if (adminUser == null) throw new BunnyException(ResultCodeEnum.DATA_NOT_EXIST); + if (adminUser == null) throw new AuthCustomerException(ResultCodeEnum.DATA_NOT_EXIST); // 如果更新了用户名,删除之前的用户数据 if (!dto.getUsername().equals(adminUser.getUsername())) { @@ -500,12 +500,12 @@ public class UserServiceImpl extends ServiceImpl implemen @Override public void deleteAdminUser(List ids) { // 判断数据请求是否为空 - if (ids.isEmpty()) throw new BunnyException(ResultCodeEnum.REQUEST_IS_EMPTY); + if (ids.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.REQUEST_IS_EMPTY); // 根据用户Id列表查询用户角色 List list = roleMapper.selectListByUserIds(ids); List roleList = list.stream().filter(role -> role.getRoleCode().equals("admin") || ids.contains(1L)).toList(); - if (!roleList.isEmpty()) throw new BunnyException(ResultCodeEnum.ADMIN_ROLE_CAN_NOT_DELETED); + if (!roleList.isEmpty()) throw new AuthCustomerException(ResultCodeEnum.ADMIN_ROLE_CAN_NOT_DELETED); // 逻辑删除 removeBatchByIds(ids); diff --git a/service/src/test/java/cn/bunny/services/service/financial/impl/BillServiceImplTest.java b/service/src/test/java/cn/bunny/services/service/financial/impl/BillServiceImplTest.java index f4f6c8f..a3ba11c 100644 --- a/service/src/test/java/cn/bunny/services/service/financial/impl/BillServiceImplTest.java +++ b/service/src/test/java/cn/bunny/services/service/financial/impl/BillServiceImplTest.java @@ -1,11 +1,11 @@ package cn.bunny.services.service.financial.impl; -import cn.bunny.common.service.exception.BunnyException; -import cn.bunny.dao.dto.financial.bill.ExpendWithIncomeDto; +import cn.bunny.common.service.exception.AuthCustomerException; +import cn.bunny.dao.dto.financial.bill.IncomeExpenseQueryDto; import cn.bunny.dao.entity.financial.Category; import cn.bunny.dao.entity.system.Message; import cn.bunny.dao.entity.system.MessageReceived; -import cn.bunny.dao.excel.BillUserExportExcel; +import cn.bunny.dao.excel.BillExportExcelByUser; import cn.bunny.dao.pojo.result.ResultCodeEnum; import cn.bunny.dao.vo.financial.user.expendAndIncome.ExpendWithIncome; import cn.bunny.services.mapper.financial.BillMapper; @@ -40,23 +40,23 @@ class BillServiceImplTest { @Test void exportBill() { // 设置数据库查询时间 - ExpendWithIncomeDto expendWithIncomeDto = new ExpendWithIncomeDto(); - expendWithIncomeDto.setUserId(1849444494908125181L); - expendWithIncomeDto.setStartDate(LocalDate.of(2024, 11, 1)); - expendWithIncomeDto.setEndDate(LocalDate.of(2024, 11, 30)); + IncomeExpenseQueryDto incomeExpenseQueryDto = new IncomeExpenseQueryDto(); + incomeExpenseQueryDto.setUserId(1849444494908125181L); + incomeExpenseQueryDto.setStartDate(LocalDate.of(2024, 11, 1)); + incomeExpenseQueryDto.setEndDate(LocalDate.of(2024, 11, 30)); // 设置日期范围 - String dateRange = expendWithIncomeDto.getStartDate() + "~" + expendWithIncomeDto.getEndDate(); + String dateRange = incomeExpenseQueryDto.getStartDate() + "~" + incomeExpenseQueryDto.getEndDate(); // 设置收入和支出的值 AtomicReference income = new AtomicReference<>(new BigDecimal(0)); AtomicReference expend = new AtomicReference<>(new BigDecimal(0)); // 查询数据 - List expendWithIncomeList = billMapper.selectListByExpendWithIncomeDto(expendWithIncomeDto); - List excelList = expendWithIncomeList.stream().map(expendWithIncome -> { - BillUserExportExcel billUserExportExcel = new BillUserExportExcel(); - BeanUtils.copyProperties(expendWithIncome, billUserExportExcel); + List expendWithIncomeList = billMapper.selectListByExpendWithIncomeDto(incomeExpenseQueryDto); + List excelList = expendWithIncomeList.stream().map(expendWithIncome -> { + BillExportExcelByUser billExportExcelByUser = new BillExportExcelByUser(); + BeanUtils.copyProperties(expendWithIncome, billExportExcelByUser); // 设置收支类型 String type; @@ -67,13 +67,13 @@ class BillServiceImplTest { type = "支出"; expend.updateAndGet(bigDecimal -> bigDecimal.add(expendWithIncome.getAmount())); } - billUserExportExcel.setType(type); + billExportExcelByUser.setType(type); - return billUserExportExcel; + return billExportExcelByUser; }).toList(); String filenameTemplate = Objects.requireNonNull(getClass().getResource("/static/bill-template.xlsx")).getFile(); - if (filenameTemplate == null) throw new BunnyException(ResultCodeEnum.MISSING_TEMPLATE_FILES); + if (filenameTemplate == null) throw new AuthCustomerException(ResultCodeEnum.MISSING_TEMPLATE_FILES); try (ExcelWriter excelWriter = EasyExcel.write("F:\\数据库备份\\" + dateRange + ".xlsx").withTemplate(filenameTemplate).build()) { // 填充数据 @@ -101,7 +101,7 @@ class BillServiceImplTest { List categoryList = categoryMapper.selectList(Wrappers.lambdaQuery().eq(Category::getUserId, userId)); String filenameTemplate = Objects.requireNonNull(getClass().getResource("/static/bill-add-template.xlsx")).getFile(); - if (filenameTemplate == null) throw new BunnyException(ResultCodeEnum.MISSING_TEMPLATE_FILES); + if (filenameTemplate == null) throw new AuthCustomerException(ResultCodeEnum.MISSING_TEMPLATE_FILES); try (ExcelWriter excelWriter = EasyExcel.write("F:\\数据库备份\\bill-add-template.xlsx").withTemplate(filenameTemplate).build()) { // 填充数据