From 632a132a6a9365c3a852cc6a3a6759fe3fc4f05d Mon Sep 17 00:00:00 2001 From: xingyu4j Date: Wed, 9 Nov 2022 11:14:46 +0800 Subject: [PATCH] refactor: Date ==> LocalDateTime --- .../framework/common/util/date/DateUtils.java | 86 +++++++++++++++++-- .../core/loader/ErrorCodeLoaderImpl.java | 6 +- .../operatelog/core/aop/OperateLogAspect.java | 12 +-- .../operatelog/core/service/OperateLog.java | 4 +- .../client/dto/PayOrderNotifyRespDTO.java | 4 +- .../client/dto/PayOrderUnifiedReqDTO.java | 4 +- .../core/client/dto/PayRefundNotifyDTO.java | 4 +- .../impl/alipay/AbstractAlipayClient.java | 7 +- .../core/client/impl/wx/WXLitePayClient.java | 5 +- .../client/impl/wx/WXNativePayClient.java | 5 +- .../core/client/impl/wx/WXPubPayClient.java | 5 +- .../core/client/dto/SmsReceiveRespDTO.java | 4 +- .../client/impl/aliyun/AliyunSmsClient.java | 6 +- .../client/impl/tencent/TencentSmsClient.java | 4 +- .../client/impl/yunpian/YunpianSmsClient.java | 3 +- .../impl/aliyun/AliyunSmsClientTest.java | 2 +- .../impl/tencent/TencentSmsClientTest.java | 2 +- .../impl/yunpian/YunpianSmsClientTest.java | 2 +- .../apollo/internals/ConfigFrameworkDAO.java | 4 +- .../apollo/internals/DBConfigRepository.java | 6 +- .../apollo/internals/dto/ConfigRespDTO.java | 4 +- .../core/handler/JobHandlerInvoker.java | 13 +-- .../core/service/JobLogFrameworkService.java | 6 +- .../framework/quartz/core/util/CronUtils.java | 8 +- .../mybatis/core/dataobject/BaseDO.java | 6 +- .../core/handler/DefaultDBFieldHandler.java | 6 +- .../framework/test/core/util/RandomUtils.java | 6 ++ .../core/filter/ApiAccessLogFilter.java | 19 ++-- .../apilog/core/service/ApiAccessLog.java | 6 +- .../apilog/core/service/ApiErrorLog.java | 4 +- .../core/handler/GlobalExceptionHandler.java | 4 +- .../definition/vo/form/BpmFormRespVO.java | 4 +- .../vo/group/BpmUserGroupPageReqVO.java | 4 +- .../vo/group/BpmUserGroupRespVO.java | 6 +- .../vo/model/BpmModelPageItemRespVO.java | 6 +- .../definition/vo/model/BpmModelRespVO.java | 4 +- .../BpmProcessDefinitionPageItemRespVO.java | 4 +- .../admin/oa/vo/BpmOALeaveBaseVO.java | 6 +- .../admin/oa/vo/BpmOALeaveCreateReqVO.java | 2 +- .../admin/oa/vo/BpmOALeavePageReqVO.java | 4 +- .../admin/oa/vo/BpmOALeaveRespVO.java | 4 +- .../task/vo/activity/BpmActivityRespVO.java | 6 +- .../BpmProcessInstanceMyPageReqVO.java | 4 +- .../BpmProcessInstancePageItemRespVO.java | 6 +- .../vo/instance/BpmProcessInstanceRespVO.java | 6 +- .../vo/task/BpmTaskDonePageItemRespVO.java | 4 +- .../task/vo/task/BpmTaskDonePageReqVO.java | 6 +- .../vo/task/BpmTaskTodoPageItemRespVO.java | 6 +- .../task/vo/task/BpmTaskTodoPageReqVO.java | 6 +- .../convert/definition/BpmModelConvert.java | 7 +- .../BpmProcessDefinitionConvert.java | 4 +- .../bpm/convert/task/BpmTaskConvert.java | 3 +- .../bpm/dal/dataobject/oa/BpmOALeaveDO.java | 6 +- .../dal/dataobject/task/BpmActivityDO.java | 8 +- .../task/BpmProcessInstanceExtDO.java | 4 +- .../bpm/dal/dataobject/task/BpmTaskExtDO.java | 4 +- .../bpm/service/oa/BpmOALeaveServiceImpl.java | 4 +- .../task/BpmProcessInstanceServiceImpl.java | 2 +- .../bpm/service/task/BpmTaskServiceImpl.java | 16 ++-- .../definition/BpmUserGroupServiceTest.java | 10 +-- .../logger/dto/ApiAccessLogCreateReqDTO.java | 6 +- .../logger/dto/ApiErrorLogCreateReqDTO.java | 4 +- .../vo/column/CodegenColumnRespVO.java | 4 +- .../vo/table/CodegenTablePageReqVO.java | 4 +- .../codegen/vo/table/CodegenTableRespVO.java | 6 +- .../admin/config/vo/ConfigExcelVO.java | 4 +- .../admin/config/vo/ConfigExportReqVO.java | 4 +- .../admin/config/vo/ConfigPageReqVO.java | 4 +- .../admin/config/vo/ConfigRespVO.java | 4 +- .../admin/db/vo/DataSourceConfigRespVO.java | 5 +- .../file/vo/config/FileConfigPageReqVO.java | 4 +- .../file/vo/config/FileConfigRespVO.java | 4 +- .../admin/file/vo/file/FilePageReqVO.java | 4 +- .../admin/file/vo/file/FileRespVO.java | 4 +- .../controller/admin/job/JobController.java | 6 +- .../admin/job/vo/job/JobExcelVO.java | 12 +-- .../admin/job/vo/job/JobRespVO.java | 4 +- .../admin/job/vo/log/JobLogBaseVO.java | 6 +- .../admin/job/vo/log/JobLogExcelVO.java | 8 +- .../admin/job/vo/log/JobLogExportReqVO.java | 6 +- .../admin/job/vo/log/JobLogPageReqVO.java | 6 +- .../admin/job/vo/log/JobLogRespVO.java | 4 +- .../vo/apiaccesslog/ApiAccessLogBaseVO.java | 6 +- .../vo/apiaccesslog/ApiAccessLogExcelVO.java | 6 +- .../apiaccesslog/ApiAccessLogExportReqVO.java | 4 +- .../apiaccesslog/ApiAccessLogPageReqVO.java | 4 +- .../vo/apiaccesslog/ApiAccessLogRespVO.java | 4 +- .../vo/apierrorlog/ApiErrorLogBaseVO.java | 4 +- .../vo/apierrorlog/ApiErrorLogExcelVO.java | 8 +- .../apierrorlog/ApiErrorLogExportReqVO.java | 4 +- .../vo/apierrorlog/ApiErrorLogPageReqVO.java | 4 +- .../vo/apierrorlog/ApiErrorLogRespVO.java | 6 +- .../admin/test/vo/TestDemoExcelVO.java | 6 +- .../admin/test/vo/TestDemoExportReqVO.java | 6 +- .../admin/test/vo/TestDemoPageReqVO.java | 5 +- .../admin/test/vo/TestDemoRespVO.java | 5 +- .../infra/dal/dataobject/job/JobLogDO.java | 6 +- .../dal/dataobject/logger/ApiAccessLogDO.java | 6 +- .../dal/dataobject/logger/ApiErrorLogDO.java | 6 +- .../infra/dal/mysql/config/ConfigDAOImpl.java | 7 +- .../dal/mysql/file/FileConfigMapper.java | 4 +- .../service/db/DatabaseTableServiceImpl.java | 2 +- .../service/file/FileConfigServiceImpl.java | 6 +- .../infra/service/job/JobLogServiceImpl.java | 6 +- .../logger/ApiErrorLogServiceImpl.java | 4 +- .../codegen/java/controller/vo/_column.vm | 2 +- .../codegen/java/controller/vo/baseVO.vm | 6 +- .../codegen/java/controller/vo/createReqVO.vm | 2 +- .../codegen/java/controller/vo/excelVO.vm | 4 +- .../codegen/java/controller/vo/exportReqVO.vm | 3 +- .../codegen/java/controller/vo/pageReqVO.vm | 3 +- .../codegen/java/controller/vo/updateReqVO.vm | 4 +- .../src/main/resources/codegen/java/dal/do.vm | 4 +- .../codegen/java/test/serviceTest.vm | 3 +- .../resources/codegen/vue/views/index.vue.vm | 2 +- .../resources/codegen/vue3/views/index.vue.vm | 4 +- .../service/config/ConfigServiceTest.java | 16 ++-- .../file/FileConfigServiceImplTest.java | 12 +-- .../infra/service/file/FileServiceTest.java | 10 +-- .../infra/service/job/JobLogServiceTest.java | 18 ++-- .../logger/ApiAccessLogServiceImplTest.java | 16 ++-- .../logger/ApiErrorLogServiceImplTest.java | 16 ++-- .../service/test/TestDemoServiceImplTest.java | 16 ++-- .../admin/coupon/vo/CouponBaseVO.java | 11 +-- .../admin/coupon/vo/CouponExcelVO.java | 14 +-- .../admin/coupon/vo/CouponExportReqVO.java | 13 ++- .../admin/coupon/vo/CouponPageReqVO.java | 12 +-- .../admin/coupon/vo/CouponRespVO.java | 5 +- .../templete/vo/CouponTempleteBaseVO.java | 9 +- .../templete/vo/CouponTempleteExcelVO.java | 11 +-- .../vo/CouponTempleteExportReqVO.java | 10 +-- .../templete/vo/CouponTempletePageReqVO.java | 10 +-- .../templete/vo/CouponTempleteRespVO.java | 5 +- .../CouponTemplete/CouponTempleteDO.java | 9 +- .../dal/dataobject/coupon/CouponDO.java | 11 +-- .../admin/banner/vo/BannerCreateReqVO.java | 3 - .../admin/banner/vo/BannerPageReqVO.java | 4 +- .../admin/banner/vo/BannerRespVO.java | 4 +- .../discount/DiscountActivityDO.java | 6 +- .../discount/DiscountProductDO.java | 6 +- .../dataobject/reward/RewardActivityDO.java | 6 +- .../admin/brand/vo/ProductBrandPageReqVO.java | 4 +- .../admin/brand/vo/ProductBrandRespVO.java | 4 +- .../category/vo/ProductCategoryRespVO.java | 5 +- .../ProductPropertyAndValueRespVO.java | 4 +- .../vo/property/ProductPropertyPageReqVO.java | 4 +- .../vo/value/ProductPropertyValueRespVO.java | 4 +- .../admin/sku/vo/ProductSkuRespVO.java | 4 +- .../admin/spu/vo/ProductSpuDetailRespVO.java | 4 +- .../admin/spu/vo/ProductSpuPageReqVO.java | 5 +- .../admin/spu/vo/ProductSpuRespVO.java | 4 +- .../dataobject/comment/ProductCommentDO.java | 4 +- .../brand/ProductBrandServiceImplTest.java | 11 +-- .../app/order/vo/TradeOrderItemRespVO.java | 4 +- .../app/order/vo/TradeOrderRespVO.java | 12 +-- .../trade/dal/dataobject/cart/CartItemDO.java | 4 +- .../dal/dataobject/order/TradeOrderDO.java | 12 +-- .../dal/dataobject/refund/TradeRefundDO.java | 8 +- .../member/api/user/dto/UserInfoDTO.java | 4 +- .../app/address/vo/AppAddressRespVO.java | 4 +- .../app/auth/vo/AppAuthLoginRespVO.java | 4 +- .../dal/dataobject/user/MemberUserDO.java | 4 +- .../service/user/MemberUserServiceImpl.java | 4 +- .../api/order/PayOrderDataCreateReqDTO.java | 4 +- .../admin/merchant/vo/app/PayAppExcelVO.java | 4 +- .../merchant/vo/app/PayAppExportReqVO.java | 6 +- .../merchant/vo/app/PayAppPageItemRespVO.java | 4 +- .../merchant/vo/app/PayAppPageReqVO.java | 5 +- .../admin/merchant/vo/app/PayAppRespVO.java | 5 +- .../vo/channel/PayChannelExcelVO.java | 6 +- .../vo/channel/PayChannelExportReqVO.java | 6 +- .../vo/channel/PayChannelPageReqVO.java | 5 +- .../merchant/vo/channel/PayChannelRespVO.java | 5 +- .../vo/merchant/PayMerchantExcelVO.java | 4 +- .../vo/merchant/PayMerchantExportReqVO.java | 6 +- .../vo/merchant/PayMerchantPageReqVO.java | 5 +- .../vo/merchant/PayMerchantRespVO.java | 4 +- .../admin/order/vo/PayOrderBaseVO.java | 8 +- .../admin/order/vo/PayOrderDetailsRespVO.java | 4 +- .../admin/order/vo/PayOrderExcelVO.java | 10 +-- .../admin/order/vo/PayOrderExportReqVO.java | 10 +-- .../order/vo/PayOrderPageItemRespVO.java | 4 +- .../admin/order/vo/PayOrderPageReqVO.java | 10 +-- .../admin/order/vo/PayOrderRespVO.java | 4 +- .../admin/refund/vo/PayRefundBaseVO.java | 8 +- .../refund/vo/PayRefundDetailsRespVO.java | 6 +- .../admin/refund/vo/PayRefundExcelVO.java | 10 +-- .../admin/refund/vo/PayRefundExportReqVO.java | 10 +-- .../refund/vo/PayRefundPageItemRespVO.java | 4 +- .../admin/refund/vo/PayRefundPageReqVO.java | 10 +-- .../admin/refund/vo/PayRefundRespVO.java | 4 +- .../dataobject/notify/PayNotifyTaskDO.java | 6 +- .../pay/dal/dataobject/order/PayOrderDO.java | 8 +- .../dal/dataobject/refund/PayRefundDO.java | 8 +- .../dal/mysql/merchant/PayChannelMapper.java | 4 +- .../mysql/notify/PayNotifyTaskCoreMapper.java | 4 +- .../merchant/PayChannelServiceImpl.java | 6 +- .../service/notify/PayNotifyServiceImpl.java | 9 +- .../service/order/PayOrderServiceImpl.java | 6 +- .../order/dto/PayOrderCreateReqDTO.java | 4 +- .../service/refund/PayRefundServiceImpl.java | 4 +- .../yudao/module/pay/util/PaySeqUtils.java | 9 +- .../service/merchant/PayAppServiceTest.java | 20 ++--- .../merchant/PayChannelServiceTest.java | 16 ++-- .../merchant/PayMerchantServiceTest.java | 16 ++-- .../service/order/PayOrderServiceTest.java | 34 ++++---- .../service/refund/PayRefundServiceTest.java | 32 +++---- .../system/api/errorcode/ErrorCodeApi.java | 4 +- .../api/errorcode/dto/ErrorCodeRespDTO.java | 4 +- .../logger/dto/OperateLogCreateReqDTO.java | 4 +- .../oauth2/dto/OAuth2AccessTokenRespDTO.java | 4 +- .../api/errorcode/ErrorCodeApiImpl.java | 4 +- .../admin/auth/vo/AuthLoginRespVO.java | 4 +- .../admin/dept/vo/dept/DeptRespVO.java | 4 +- .../admin/dept/vo/post/PostRespVO.java | 4 +- .../admin/dict/vo/data/DictDataRespVO.java | 4 +- .../dict/vo/type/DictTypeExportReqVO.java | 4 +- .../admin/dict/vo/type/DictTypePageReqVO.java | 4 +- .../admin/dict/vo/type/DictTypeRespVO.java | 4 +- .../admin/errorcode/vo/ErrorCodeExcelVO.java | 5 +- .../errorcode/vo/ErrorCodeExportReqVO.java | 4 +- .../errorcode/vo/ErrorCodePageReqVO.java | 4 +- .../admin/errorcode/vo/ErrorCodeRespVO.java | 4 +- .../logger/vo/loginlog/LoginLogExcelVO.java | 4 +- .../vo/loginlog/LoginLogExportReqVO.java | 4 +- .../logger/vo/loginlog/LoginLogPageReqVO.java | 4 +- .../logger/vo/loginlog/LoginLogRespVO.java | 4 +- .../vo/operatelog/OperateLogBaseVO.java | 4 +- .../vo/operatelog/OperateLogExcelVO.java | 4 +- .../vo/operatelog/OperateLogExportReqVO.java | 4 +- .../vo/operatelog/OperateLogPageReqVO.java | 4 +- .../admin/notice/vo/NoticeRespVO.java | 4 +- .../oauth2/vo/client/OAuth2ClientRespVO.java | 4 +- .../vo/token/OAuth2AccessTokenRespVO.java | 6 +- .../admin/permission/vo/menu/MenuRespVO.java | 4 +- .../permission/vo/role/RoleExportReqVO.java | 4 +- .../permission/vo/role/RolePageReqVO.java | 4 +- .../admin/permission/vo/role/RoleRespVO.java | 4 +- .../vo/SensitiveWordExcelVO.java | 4 +- .../vo/SensitiveWordExportReqVO.java | 4 +- .../vo/SensitiveWordPageReqVO.java | 4 +- .../sensitiveword/vo/SensitiveWordRespVO.java | 4 +- .../sms/vo/channel/SmsChannelPageReqVO.java | 4 +- .../sms/vo/channel/SmsChannelRespVO.java | 4 +- .../admin/sms/vo/log/SmsLogExcelVO.java | 8 +- .../admin/sms/vo/log/SmsLogExportReqVO.java | 6 +- .../admin/sms/vo/log/SmsLogPageReqVO.java | 6 +- .../admin/sms/vo/log/SmsLogRespVO.java | 8 +- .../sms/vo/template/SmsTemplateExcelVO.java | 4 +- .../vo/template/SmsTemplateExportReqVO.java | 4 +- .../sms/vo/template/SmsTemplatePageReqVO.java | 4 +- .../sms/vo/template/SmsTemplateRespVO.java | 4 +- .../vo/packages/TenantPackagePageReqVO.java | 4 +- .../vo/packages/TenantPackageRespVO.java | 4 +- .../admin/tenant/vo/tenant/TenantBaseVO.java | 4 +- .../admin/tenant/vo/tenant/TenantExcelVO.java | 4 +- .../tenant/vo/tenant/TenantExportReqVO.java | 4 +- .../tenant/vo/tenant/TenantPageReqVO.java | 4 +- .../admin/tenant/vo/tenant/TenantRespVO.java | 5 +- .../user/vo/profile/UserProfileRespVO.java | 6 +- .../admin/user/vo/user/UserExcelVO.java | 4 +- .../admin/user/vo/user/UserExportReqVO.java | 4 +- .../admin/user/vo/user/UserPageReqVO.java | 4 +- .../admin/user/vo/user/UserRespVO.java | 7 +- .../convert/oauth2/OAuth2OpenConvert.java | 3 +- .../dal/dataobject/logger/OperateLogDO.java | 4 +- .../oauth2/OAuth2AccessTokenDO.java | 4 +- .../dataobject/oauth2/OAuth2ApproveDO.java | 4 +- .../dal/dataobject/oauth2/OAuth2CodeDO.java | 4 +- .../oauth2/OAuth2RefreshTokenDO.java | 4 +- .../system/dal/dataobject/sms/SmsCodeDO.java | 4 +- .../system/dal/dataobject/sms/SmsLogDO.java | 6 +- .../dal/dataobject/tenant/TenantDO.java | 4 +- .../dal/dataobject/user/AdminUserDO.java | 4 +- .../system/dal/mysql/dept/DeptMapper.java | 4 +- .../dal/mysql/errorcode/ErrorCodeMapper.java | 4 +- .../mysql/oauth2/OAuth2AccessTokenMapper.java | 4 +- .../dal/mysql/oauth2/OAuth2ClientMapper.java | 5 +- .../dal/mysql/permission/MenuMapper.java | 4 +- .../dal/mysql/permission/RoleMapper.java | 4 +- .../dal/mysql/permission/RoleMenuMapper.java | 4 +- .../dal/mysql/permission/UserRoleMapper.java | 4 +- .../sensitiveword/SensitiveWordMapper.java | 4 +- .../dal/mysql/sms/SmsChannelMapper.java | 4 +- .../dal/mysql/sms/SmsTemplateMapper.java | 4 +- .../system/dal/mysql/tenant/TenantMapper.java | 4 +- .../oauth2/OAuth2AccessTokenRedisDAO.java | 7 +- .../system/service/dept/DeptServiceImpl.java | 5 +- .../service/errorcode/ErrorCodeService.java | 4 +- .../errorcode/ErrorCodeServiceImpl.java | 4 +- .../oauth2/OAuth2ApproveServiceImpl.java | 7 +- .../oauth2/OAuth2ClientServiceImpl.java | 5 +- .../service/oauth2/OAuth2CodeServiceImpl.java | 4 +- .../oauth2/OAuth2TokenServiceImpl.java | 5 +- .../service/permission/MenuServiceImpl.java | 5 +- .../permission/PermissionServiceImpl.java | 9 +- .../service/permission/RoleServiceImpl.java | 5 +- .../SensitiveWordServiceImpl.java | 5 +- .../service/sms/SmsChannelServiceImpl.java | 6 +- .../service/sms/SmsCodeServiceImpl.java | 15 ++-- .../system/service/sms/SmsLogService.java | 4 +- .../system/service/sms/SmsLogServiceImpl.java | 6 +- .../service/sms/SmsTemplateServiceImpl.java | 5 +- .../service/user/AdminUserServiceImpl.java | 3 +- .../system/util/oauth2/OAuth2Utils.java | 9 +- .../oauth2/OAuth2OpenControllerTest.java | 16 ++-- .../system/service/dept/DeptServiceTest.java | 4 +- .../service/dict/DictTypeServiceTest.java | 16 ++-- .../errorcode/ErrorCodeServiceTest.java | 12 +-- .../logger/LoginLogServiceImplTest.java | 16 ++-- .../logger/OperateLogServiceImplTest.java | 16 ++-- .../oauth2/OAuth2ApproveServiceImplTest.java | 18 ++-- .../oauth2/OAuth2CodeServiceImplTest.java | 7 +- .../oauth2/OAuth2TokenServiceImplTest.java | 21 +++-- .../permission/PermissionServiceTest.java | 5 +- .../service/permission/RoleServiceTest.java | 15 ++-- .../SensitiveWordServiceImplTest.java | 16 ++-- .../service/sms/SmsChannelServiceTest.java | 12 +-- .../system/service/sms/SmsLogServiceTest.java | 30 +++---- .../service/sms/SmsTemplateServiceTest.java | 18 ++-- .../tenant/TenantPackageServiceImplTest.java | 10 +-- .../service/tenant/TenantServiceImplTest.java | 22 +++-- .../user/AdminUserServiceImplTest.java | 12 +-- .../app/AppShopOrderController.java | 7 +- 324 files changed, 1137 insertions(+), 997 deletions(-) diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java index 97fe67f61..4fe1dbc3e 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java @@ -1,8 +1,14 @@ package cn.iocoder.yudao.framework.common.util.date; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; import java.time.Duration; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.ZonedDateTime; +import java.time.temporal.ChronoUnit; import java.util.Calendar; import java.util.Date; @@ -25,6 +31,22 @@ public class DateUtils { public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss"; + public static Date localDateTimeToDate(LocalDateTime date){ + // 将此日期时间与时区相结合以创建 ZonedDateTime + ZonedDateTime zonedDateTime = date.atZone(ZoneId.systemDefault()); + // 本地时间线LocalDateTime到即时时间线Instant时间戳 + Instant instant = zonedDateTime.toInstant(); + // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 + return Date.from(instant); + } + + public static LocalDateTime dateToLocalDateTime(Date date){ + // 转为时间戳 + Instant instant = date.toInstant(); + // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 + return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); + } + public static Date addTime(Duration duration) { return new Date(System.currentTimeMillis() + duration.toMillis()); } @@ -33,6 +55,11 @@ public class DateUtils { return System.currentTimeMillis() > time.getTime(); } + public static boolean isExpired(LocalDateTime time) { + LocalDateTime now = LocalDateTime.now(); + return now.isAfter(time); + } + public static long diff(Date endTime, Date startTime) { return endTime.getTime() - startTime.getTime(); } @@ -40,24 +67,28 @@ public class DateUtils { /** * 创建指定时间 * - * @param year 年 - * @param mouth 月 - * @param day 日 + * @param year 年 + * @param mouth 月 + * @param day 日 * @return 指定时间 */ public static Date buildTime(int year, int mouth, int day) { return buildTime(year, mouth, day, 0, 0, 0); } + public static LocalDateTime buildLocalDateTime(int year, int mouth, int day) { + return buildLocalDateTime(year, mouth, day, 0, 0, 0); + } + /** * 创建指定时间 * - * @param year 年 - * @param mouth 月 - * @param day 日 - * @param hour 小时 - * @param minute 分钟 - * @param second 秒 + * @param year 年 + * @param mouth 月 + * @param day 日 + * @param hour 小时 + * @param minute 分钟 + * @param second 秒 * @return 指定时间 */ public static Date buildTime(int year, int mouth, int day, @@ -73,6 +104,19 @@ public class DateUtils { return calendar.getTime(); } + public static LocalDateTime buildLocalDateTime(int year, int mouth, int day, + int hour, int minute, int second) { + Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.YEAR, year); + calendar.set(Calendar.MONTH, mouth - 1); + calendar.set(Calendar.DAY_OF_MONTH, day); + calendar.set(Calendar.HOUR_OF_DAY, hour); + calendar.set(Calendar.MINUTE, minute); + calendar.set(Calendar.SECOND, second); + calendar.set(Calendar.MILLISECOND, 0); // 一般情况下,都是 0 毫秒 + return dateToLocalDateTime(calendar.getTime()); + } + public static Date max(Date a, Date b) { if (a == null) { return b; @@ -83,6 +127,16 @@ public class DateUtils { return a.compareTo(b) > 0 ? a : b; } + public static LocalDateTime maxLocalDateTime(LocalDateTime a, LocalDateTime b) { + if (a == null) { + return b; + } + if (b == null) { + return a; + } + return a.compareTo(b) > 0 ? a : b; + } + public static boolean beforeNow(Date date) { return date.getTime() < System.currentTimeMillis(); } @@ -91,6 +145,10 @@ public class DateUtils { return date.getTime() >= System.currentTimeMillis(); } + public static boolean afterNow(LocalDateTime localDateTime) { + return localDateTime.isAfter(LocalDateTime.now()); + } + /** * 计算当期时间相差的日期 * @@ -135,4 +193,14 @@ public class DateUtils { return DateUtil.isSameDay(date, new Date()); } + /** + * 是否今天 + * + * @param date 日期 + * @return 是否 + */ + public static boolean isToday(LocalDateTime date) { + return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now()); + } + } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java b/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java index 5f327424a..b3c85382b 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java @@ -10,7 +10,7 @@ import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; import org.springframework.scheduling.annotation.Scheduled; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; /** @@ -41,7 +41,7 @@ public class ErrorCodeLoaderImpl implements ErrorCodeLoader { /** * 缓存错误码的最大更新时间,用于后续的增量轮询,判断是否有更新 */ - private Date maxUpdateTime; + private LocalDateTime maxUpdateTime; @EventListener(ApplicationReadyEvent.class) public void loadErrorCodes() { @@ -66,7 +66,7 @@ public class ErrorCodeLoaderImpl implements ErrorCodeLoader { // 写入到错误码的缓存 putErrorCode(errorCodeRespDTO.getCode(), errorCodeRespDTO.getMessage()); // 记录下更新时间,方便增量更新 - maxUpdateTime = DateUtils.max(maxUpdateTime, errorCodeRespDTO.getUpdateTime()); + maxUpdateTime = DateUtils.maxLocalDateTime(maxUpdateTime, errorCodeRespDTO.getUpdateTime()); }); } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java b/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java index d3b94d25a..75819cbe1 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.operatelog.core.aop; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.exceptions.ExceptionUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.StrUtil; @@ -32,6 +33,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.lang.annotation.Annotation; import java.lang.reflect.Array; +import java.time.LocalDateTime; import java.util.*; import java.util.function.Predicate; import java.util.stream.IntStream; @@ -94,7 +96,7 @@ public class OperateLogAspect { } // 记录开始时间 - Date startTime = new Date(); + LocalDateTime startTime = LocalDateTime.now(); try { // 执行原有方法 Object result = joinPoint.proceed(); @@ -128,7 +130,7 @@ public class OperateLogAspect { private void log(ProceedingJoinPoint joinPoint, cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog, ApiOperation apiOperation, - Date startTime, Object result, Throwable exception) { + LocalDateTime startTime, Object result, Throwable exception) { try { // 判断不记录的情况 if (!isLogEnable(joinPoint, operateLog)) { @@ -145,7 +147,7 @@ public class OperateLogAspect { private void log0(ProceedingJoinPoint joinPoint, cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog, ApiOperation apiOperation, - Date startTime, Object result, Throwable exception) { + LocalDateTime startTime, Object result, Throwable exception) { OperateLog operateLogObj = new OperateLog(); // 补全通用字段 operateLogObj.setTraceId(TracerUtils.getTraceId()); @@ -226,7 +228,7 @@ public class OperateLogAspect { private static void fillMethodFields(OperateLog operateLogObj, ProceedingJoinPoint joinPoint, cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog, - Date startTime, Object result, Throwable exception) { + LocalDateTime startTime, Object result, Throwable exception) { MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); operateLogObj.setJavaMethod(methodSignature.toString()); if (operateLog == null || operateLog.logArgs()) { @@ -235,7 +237,7 @@ public class OperateLogAspect { if (operateLog == null || operateLog.logResultData()) { operateLogObj.setResultData(obtainResultData(result)); } - operateLogObj.setDuration((int) (System.currentTimeMillis() - startTime.getTime())); + operateLogObj.setDuration((int) (LocalDateTimeUtil.between(startTime, LocalDateTime.now()).toMillis())); // (正常)处理 resultCode 和 resultMsg 字段 if (result instanceof CommonResult) { CommonResult commonResult = (CommonResult) result; diff --git a/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLog.java b/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLog.java index 7bce1c6bd..1e3b8c8a8 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLog.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLog.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.operatelog.core.service; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; import java.util.Map; /** @@ -85,7 +85,7 @@ public class OperateLog { /** * 开始时间 */ - private Date startTime; + private LocalDateTime startTime; /** * 执行时长,单位:毫秒 diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java index a5c24c24e..91f3b2a37 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java @@ -5,7 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.util.Date; +import java.time.LocalDateTime; /** * 支付通知 Response DTO @@ -33,7 +33,7 @@ public class PayOrderNotifyRespDTO { /** * 支付成功时间 */ - private Date successTime; + private LocalDateTime successTime; /** * 通知的原始数据 diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java index 6f99bb80d..ea3628931 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java @@ -7,7 +7,7 @@ import org.hibernate.validator.constraints.URL; import javax.validation.constraints.DecimalMin; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; import java.util.Map; /** @@ -68,7 +68,7 @@ public class PayOrderUnifiedReqDTO { * 支付过期时间 */ @NotNull(message = "支付过期时间不能为空") - private Date expireTime; + private LocalDateTime expireTime; // ========== 拓展参数 ========== /** diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java index 05fcff3c1..edb593d82 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java @@ -5,7 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; /** * 从渠道返回数据中解析得到的支付退款通知的Notify DTO @@ -57,7 +57,7 @@ public class PayRefundNotifyDTO { /** * 退款成功时间 */ - private Date refundSuccessTime; + private LocalDateTime refundSuccessTime; } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java index 41c473be7..680d80d77 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java @@ -1,8 +1,7 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.date.DateUtil; -import cn.hutool.http.HttpUtil; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; import cn.iocoder.yudao.framework.pay.core.client.dto.*; @@ -61,7 +60,7 @@ public abstract class AbstractAlipayClient extends AbstractPayClient { .builder() .orderExtensionNo(result.getOutTradeNo()) .channelOrderNo(result.getTradeState()) - .successTime(DateUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) + .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) .data(data.getBody()) .build(); } @@ -181,7 +182,7 @@ public class WXLitePayClient extends AbstractPayClient { .orderExtensionNo(notifyResult.getOutTradeNo()) .channelOrderNo(notifyResult.getTransactionId()) .channelUserId(notifyResult.getOpenid()) - .successTime(DateUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) + .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) .data(data.getBody()) .build(); diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java index 20ad91c82..f9ccd4629 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.wx; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.util.io.FileUtils; @@ -150,7 +151,7 @@ public class WXNativePayClient extends AbstractPayClient { .builder() .orderExtensionNo(result.getOutTradeNo()) .channelOrderNo(result.getTradeState()) - .successTime(DateUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) + .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) .data(data.getBody()) .build(); } @@ -164,7 +165,7 @@ public class WXNativePayClient extends AbstractPayClient { .orderExtensionNo(notifyResult.getOutTradeNo()) .channelOrderNo(notifyResult.getTransactionId()) .channelUserId(notifyResult.getOpenid()) - .successTime(DateUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) + .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) .data(data.getBody()) .build(); diff --git a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java index 238344759..84e3064c3 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.wx; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.StrUtil; @@ -161,7 +162,7 @@ public class WXPubPayClient extends AbstractPayClient { .builder() .orderExtensionNo(result.getOutTradeNo()) .channelOrderNo(result.getTradeState()) - .successTime(DateUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) + .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) .data(data.getBody()) .build(); } @@ -175,7 +176,7 @@ public class WXPubPayClient extends AbstractPayClient { .orderExtensionNo(notifyResult.getOutTradeNo()) .channelOrderNo(notifyResult.getTransactionId()) .channelUserId(notifyResult.getOpenid()) - .successTime(DateUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) + .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) .data(data.getBody()) .build(); diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/dto/SmsReceiveRespDTO.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/dto/SmsReceiveRespDTO.java index 8c841ebea..4def4a25c 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/dto/SmsReceiveRespDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/dto/SmsReceiveRespDTO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.sms.core.client.dto; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; /** * 消息接收 Response DTO @@ -32,7 +32,7 @@ public class SmsReceiveRespDTO { /** * 用户接收时间 */ - private Date receiveTime; + private LocalDateTime receiveTime; /** * 短信 API 发送返回的序号 diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClient.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClient.java index ae93a88b6..62cd6bcd5 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClient.java @@ -28,7 +28,7 @@ import com.google.common.annotations.VisibleForTesting; import lombok.Data; import lombok.extern.slf4j.Slf4j; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -166,13 +166,13 @@ public class AliyunSmsClient extends AbstractSmsClient { */ @JsonProperty("send_time") @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date sendTime; + private LocalDateTime sendTime; /** * 状态报告时间 */ @JsonProperty("report_time") @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date reportTime; + private LocalDateTime reportTime; /** * 是否接收成功 */ diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClient.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClient.java index 23bb01a02..743c1aed8 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClient.java @@ -22,7 +22,7 @@ import com.tencentcloudapi.sms.v20210111.SmsClient; import com.tencentcloudapi.sms.v20210111.models.*; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; import java.util.function.Function; import java.util.function.Supplier; @@ -240,7 +240,7 @@ public class TencentSmsClient extends AbstractSmsClient { */ @JsonProperty("user_receive_time") @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date receiveTime; + private LocalDateTime receiveTime; /** * 国家(或地区)码 diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java index 12cb6635c..3cbd07df9 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java @@ -23,6 +23,7 @@ import com.yunpian.sdk.model.Template; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import java.time.LocalDateTime; import java.util.*; import java.util.function.Function; import java.util.function.Supplier; @@ -198,7 +199,7 @@ public class YunpianSmsClient extends AbstractSmsClient { */ @JsonProperty("user_receive_time") @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date userReceiveTime; + private LocalDateTime userReceiveTime; } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClientTest.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClientTest.java index e65e23db7..6fc76e7cf 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClientTest.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClientTest.java @@ -125,7 +125,7 @@ public class AliyunSmsClientTest extends BaseMockitoUnitTest { assertEquals("DELIVERED", statuses.get(0).getErrorCode()); assertEquals("用户接收成功", statuses.get(0).getErrorMsg()); assertEquals("13900000001", statuses.get(0).getMobile()); - assertEquals(DateUtils.buildTime(2017, 2, 2, 22, 23, 24), statuses.get(0).getReceiveTime()); + assertEquals(DateUtils.buildLocalDateTime(2017, 2, 2, 22, 23, 24), statuses.get(0).getReceiveTime()); assertEquals("12345", statuses.get(0).getSerialNo()); assertEquals(67890L, statuses.get(0).getLogId()); } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClientTest.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClientTest.java index 64305c7a0..ded447be0 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClientTest.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClientTest.java @@ -146,7 +146,7 @@ public class TencentSmsClientTest extends BaseMockitoUnitTest { assertEquals("DELIVRD", statuses.get(0).getErrorCode()); assertEquals("用户短信送达成功", statuses.get(0).getErrorMsg()); assertEquals("13900000001", statuses.get(0).getMobile()); - assertEquals(DateUtils.buildTime(2015, 10, 17, 8, 3, 4), statuses.get(0).getReceiveTime()); + assertEquals(DateUtils.buildLocalDateTime(2015, 10, 17, 8, 3, 4), statuses.get(0).getReceiveTime()); assertEquals("12345", statuses.get(0).getSerialNo()); assertEquals(67890L, statuses.get(0).getLogId()); } diff --git a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClientTest.java b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClientTest.java index 8271c0d7b..3024b19f9 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClientTest.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClientTest.java @@ -115,7 +115,7 @@ public class YunpianSmsClientTest extends BaseMockitoUnitTest { assertEquals("", statuses.get(0).getErrorCode()); assertNull(statuses.get(0).getErrorMsg()); assertEquals("15205201314", statuses.get(0).getMobile()); - assertEquals(DateUtils.buildTime(2014, 3, 17, 22, 55, 21), statuses.get(0).getReceiveTime()); + assertEquals(DateUtils.buildLocalDateTime(2014, 3, 17, 22, 55, 21), statuses.get(0).getReceiveTime()); assertEquals("9527", statuses.get(0).getSerialNo()); assertEquals(1024L, statuses.get(0).getLogId()); } diff --git a/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/ConfigFrameworkDAO.java b/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/ConfigFrameworkDAO.java index 95f44b36c..a5df4c503 100644 --- a/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/ConfigFrameworkDAO.java +++ b/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/ConfigFrameworkDAO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.apollo.internals; import cn.iocoder.yudao.framework.apollo.internals.dto.ConfigRespDTO; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; /** @@ -20,7 +20,7 @@ public interface ConfigFrameworkDAO { * @param maxUpdateTime 最大更新时间 * @return 是否存在 */ - int selectCountByUpdateTimeGt(Date maxUpdateTime); + int selectCountByUpdateTimeGt(LocalDateTime maxUpdateTime); /** * 查询配置列表 diff --git a/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/DBConfigRepository.java b/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/DBConfigRepository.java index e41cb5780..3e3563d39 100644 --- a/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/DBConfigRepository.java +++ b/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/DBConfigRepository.java @@ -18,8 +18,8 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import java.lang.reflect.Constructor; +import java.time.LocalDateTime; import java.util.Comparator; -import java.util.Date; import java.util.List; import java.util.Properties; import java.util.concurrent.Executors; @@ -48,7 +48,7 @@ public class DBConfigRepository extends AbstractConfigRepository { /** * 缓存配置的最大更新时间,用于后续的增量轮询,判断是否有更新 */ - private volatile Date maxUpdateTime; + private volatile LocalDateTime maxUpdateTime; /** * 配置读取 DAO @@ -166,7 +166,7 @@ public class DBConfigRepository extends AbstractConfigRepository { * @param maxUpdateTime 当前配置的最大更新时间 * @return 配置列表 */ - private List loadConfigIfUpdate(Date maxUpdateTime) { + private List loadConfigIfUpdate(LocalDateTime maxUpdateTime) { // 第一步,判断是否要更新。 if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据 log.info("[loadConfigIfUpdate][首次加载全量配置]"); diff --git a/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/dto/ConfigRespDTO.java b/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/dto/ConfigRespDTO.java index 350c94e42..306fd96ef 100644 --- a/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/dto/ConfigRespDTO.java +++ b/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/dto/ConfigRespDTO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.apollo.internals.dto; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; /** * 配置 Response DTO @@ -28,6 +28,6 @@ public class ConfigRespDTO { /** * 更新时间 */ - private Date updateTime; + private LocalDateTime updateTime; } diff --git a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/handler/JobHandlerInvoker.java b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/handler/JobHandlerInvoker.java index d47be8352..736126fec 100644 --- a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/handler/JobHandlerInvoker.java +++ b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/handler/JobHandlerInvoker.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.quartz.core.handler; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.thread.ThreadUtil; import cn.iocoder.yudao.framework.quartz.core.enums.JobDataKeyEnum; @@ -13,10 +14,10 @@ import org.springframework.context.ApplicationContext; import org.springframework.scheduling.quartz.QuartzJobBean; import javax.annotation.Resource; -import java.util.Date; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; import static cn.hutool.core.exceptions.ExceptionUtil.getRootCauseMessage; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.diff; /** * 基础 Job 调用者,负责调用 {@link JobHandler#execute(String)} 执行任务 @@ -46,7 +47,7 @@ public class JobHandlerInvoker extends QuartzJobBean { // 第二步,执行任务 Long jobLogId = null; - Date startTime = new Date(); + LocalDateTime startTime = LocalDateTime.now(); String data = null; Throwable exception = null; try { @@ -73,9 +74,9 @@ public class JobHandlerInvoker extends QuartzJobBean { return jobHandler.execute(jobHandlerParam); } - private void updateJobLogResultAsync(Long jobLogId, Date startTime, String data, Throwable exception, + private void updateJobLogResultAsync(Long jobLogId, LocalDateTime startTime, String data, Throwable exception, JobExecutionContext executionContext) { - Date endTime = new Date(); + LocalDateTime endTime = LocalDateTime.now(); // 处理是否成功 boolean success = exception == null; if (!success) { @@ -83,7 +84,7 @@ public class JobHandlerInvoker extends QuartzJobBean { } // 更新日志 try { - jobLogFrameworkService.updateJobLogResultAsync(jobLogId, endTime, (int) diff(endTime, startTime), success, data); + jobLogFrameworkService.updateJobLogResultAsync(jobLogId, endTime, (int) LocalDateTimeUtil.between(startTime, endTime).toMillis(), success, data); } catch (Exception ex) { log.error("[executeInternal][Job({}) logId({}) 记录执行日志失败({}/{})]", executionContext.getJobDetail().getKey(), jobLogId, success, data); diff --git a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/service/JobLogFrameworkService.java b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/service/JobLogFrameworkService.java index ca5d0ccbc..889921dfd 100644 --- a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/service/JobLogFrameworkService.java +++ b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/service/JobLogFrameworkService.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.quartz.core.service; import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; /** * Job 日志 Framework Service 接口 @@ -22,7 +22,7 @@ public interface JobLogFrameworkService { * @return Job 日志的编号 */ Long createJobLog(@NotNull(message = "任务编号不能为空") Long jobId, - @NotNull(message = "开始时间") Date beginTime, + @NotNull(message = "开始时间") LocalDateTime beginTime, @NotEmpty(message = "Job 处理器的名字不能为空") String jobHandlerName, String jobHandlerParam, @NotNull(message = "第几次执行不能为空") Integer executeIndex); @@ -37,7 +37,7 @@ public interface JobLogFrameworkService { * @param result 成功数据 */ void updateJobLogResultAsync(@NotNull(message = "日志编号不能为空") Long logId, - @NotNull(message = "结束时间不能为空") Date endTime, + @NotNull(message = "结束时间不能为空") LocalDateTime endTime, @NotNull(message = "运行时长不能为空") Integer duration, boolean success, String result); diff --git a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/util/CronUtils.java b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/util/CronUtils.java index ccef9b374..9b5a2bff7 100644 --- a/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/util/CronUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/util/CronUtils.java @@ -1,8 +1,10 @@ package cn.iocoder.yudao.framework.quartz.core.util; +import cn.hutool.core.date.LocalDateTimeUtil; import org.quartz.CronExpression; import java.text.ParseException; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -31,7 +33,7 @@ public class CronUtils { * @param n 数量 * @return 满足条件的执行时间 */ - public static List getNextTimes(String cronExpression, int n) { + public static List getNextTimes(String cronExpression, int n) { // 获得 CronExpression 对象 CronExpression cron; try { @@ -41,10 +43,10 @@ public class CronUtils { } // 从当前开始计算,n 个满足条件的 Date now = new Date(); - List nextTimes = new ArrayList<>(n); + List nextTimes = new ArrayList<>(n); for (int i = 0; i < n; i++) { Date nextTime = cron.getNextValidTimeAfter(now); - nextTimes.add(nextTime); + nextTimes.add(LocalDateTimeUtil.of(nextTime)); // 切换现在,为下一个触发时间; now = nextTime; } diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java index 7bb555450..19abaa6fe 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java @@ -7,7 +7,7 @@ import lombok.Data; import org.apache.ibatis.type.JdbcType; import java.io.Serializable; -import java.util.Date; +import java.time.LocalDateTime; /** * 基础实体对象 @@ -21,12 +21,12 @@ public abstract class BaseDO implements Serializable { * 创建时间 */ @TableField(fill = FieldFill.INSERT) - private Date createTime; + private LocalDateTime createTime; /** * 最后更新时间 */ @TableField(fill = FieldFill.INSERT_UPDATE) - private Date updateTime; + private LocalDateTime updateTime; /** * 创建者,目前使用 SysUser 的 id 编号 * diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/handler/DefaultDBFieldHandler.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/handler/DefaultDBFieldHandler.java index 65910b16e..94dada129 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/handler/DefaultDBFieldHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/handler/DefaultDBFieldHandler.java @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; import org.apache.ibatis.reflection.MetaObject; -import java.util.Date; +import java.time.LocalDateTime; import java.util.Objects; /** @@ -22,7 +22,7 @@ public class DefaultDBFieldHandler implements MetaObjectHandler { if (Objects.nonNull(metaObject) && metaObject.getOriginalObject() instanceof BaseDO) { BaseDO baseDO = (BaseDO) metaObject.getOriginalObject(); - Date current = new Date(); + LocalDateTime current = LocalDateTime.now(); // 创建时间为空,则以当前时间为插入时间 if (Objects.isNull(baseDO.getCreateTime())) { baseDO.setCreateTime(current); @@ -49,7 +49,7 @@ public class DefaultDBFieldHandler implements MetaObjectHandler { // 更新时间为空,则以当前时间为更新时间 Object modifyTime = getFieldValByName("updateTime", metaObject); if (Objects.isNull(modifyTime)) { - setFieldValByName("updateTime", new Date(), metaObject); + setFieldValByName("updateTime", LocalDateTime.now(), metaObject); } // 当前登录用户不为空,更新人为空,则当前登录用户为更新人 diff --git a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java index d41c3951e..8664dae42 100644 --- a/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.test.core.util; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; @@ -8,6 +9,7 @@ import uk.co.jemos.podam.api.PodamFactory; import uk.co.jemos.podam.api.PodamFactoryImpl; import java.lang.reflect.Type; +import java.time.LocalDateTime; import java.util.Arrays; import java.util.Date; import java.util.List; @@ -76,6 +78,10 @@ public class RandomUtils { return RandomUtil.randomDay(0, RANDOM_DATE_MAX); } + public static LocalDateTime randomLocalDateTime() { + return LocalDateTimeUtil.of(randomDate()); + } + public static Short randomShort() { return (short) RandomUtil.randomInt(0, Short.MAX_VALUE); } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java index 6417189b0..3a2ab6bd4 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.framework.apilog.core.filter; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.exceptions.ExceptionUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.extra.servlet.ServletUtil; @@ -7,7 +8,6 @@ import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLog; import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService; import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; import cn.iocoder.yudao.framework.web.config.WebProperties; @@ -20,7 +20,8 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; -import java.util.Date; +import java.time.LocalDateTime; +import java.time.temporal.ChronoUnit; import java.util.Map; import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; @@ -47,7 +48,7 @@ public class ApiAccessLogFilter extends ApiRequestFilter { protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { // 获得开始时间 - Date beginTim = new Date(); + LocalDateTime beginTime = LocalDateTime.now(); // 提前获得参数,避免 XssFilter 过滤处理 Map queryString = ServletUtil.getParamMap(request); String requestBody = ServletUtils.isJsonRequest(request) ? ServletUtil.getBody(request) : null; @@ -56,15 +57,15 @@ public class ApiAccessLogFilter extends ApiRequestFilter { // 继续过滤器 filterChain.doFilter(request, response); // 正常执行,记录日志 - createApiAccessLog(request, beginTim, queryString, requestBody, null); + createApiAccessLog(request, beginTime, queryString, requestBody, null); } catch (Exception ex) { // 异常执行,记录日志 - createApiAccessLog(request, beginTim, queryString, requestBody, ex); + createApiAccessLog(request, beginTime, queryString, requestBody, ex); throw ex; } } - private void createApiAccessLog(HttpServletRequest request, Date beginTime, + private void createApiAccessLog(HttpServletRequest request, LocalDateTime beginTime, Map queryString, String requestBody, Exception ex) { ApiAccessLog accessLog = new ApiAccessLog(); try { @@ -75,7 +76,7 @@ public class ApiAccessLogFilter extends ApiRequestFilter { } } - private void buildApiAccessLogDTO(ApiAccessLog accessLog, HttpServletRequest request, Date beginTime, + private void buildApiAccessLogDTO(ApiAccessLog accessLog, HttpServletRequest request, LocalDateTime beginTime, Map queryString, String requestBody, Exception ex) { // 处理用户信息 accessLog.setUserId(WebFrameworkUtils.getLoginUserId(request)); @@ -103,8 +104,8 @@ public class ApiAccessLogFilter extends ApiRequestFilter { accessLog.setUserIp(ServletUtil.getClientIP(request)); // 持续时间 accessLog.setBeginTime(beginTime); - accessLog.setEndTime(new Date()); - accessLog.setDuration((int) DateUtils.diff(accessLog.getEndTime(), accessLog.getBeginTime())); + accessLog.setEndTime(LocalDateTime.now()); + accessLog.setDuration((int) LocalDateTimeUtil.between(accessLog.getBeginTime(), accessLog.getEndTime(), ChronoUnit.SECONDS)); } } diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java index a92b06c26..7799c42f6 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.apilog.core.service; import lombok.Data; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; /** * API 访问日志 @@ -61,12 +61,12 @@ public class ApiAccessLog { * 开始请求时间 */ @NotNull(message = "开始请求时间不能为空") - private Date beginTime; + private LocalDateTime beginTime; /** * 结束请求时间 */ @NotNull(message = "结束请求时间不能为空") - private Date endTime; + private LocalDateTime endTime; /** * 执行时长,单位:毫秒 */ diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java index 3f5d539cb..087dd5d08 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.apilog.core.service; import lombok.Data; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; /** * API 错误日志 @@ -61,7 +61,7 @@ public class ApiErrorLog { * 异常时间 */ @NotNull(message = "异常时间不能为空") - private Date exceptionTime; + private LocalDateTime exceptionTime; /** * 异常名 */ diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java index 7a0fe6be7..78b438af6 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java @@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletRequest; import javax.validation.ConstraintViolation; import javax.validation.ConstraintViolationException; import javax.validation.ValidationException; -import java.util.Date; +import java.time.LocalDateTime; import java.util.Map; import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.*; @@ -267,7 +267,7 @@ public class GlobalExceptionHandler { errorLog.setRequestMethod(request.getMethod()); errorLog.setUserAgent(ServletUtils.getUserAgent(request)); errorLog.setUserIp(ServletUtil.getClientIP(request)); - errorLog.setExceptionTime(new Date()); + errorLog.setExceptionTime(LocalDateTime.now()); } } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java index 76cf62046..e49f09879 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; @ApiModel("管理后台 - 动态表单 Response VO") @@ -28,6 +28,6 @@ public class BpmFormRespVO extends BpmFormBaseVO { private List fields; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java index 2bbe95192..2608607bf 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java @@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 用户组分页 Request VO") @Data @@ -25,6 +25,6 @@ public class BpmUserGroupPageReqVO extends PageParam { @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "创建时间") - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java index 55018d502..b3d4693f3 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java @@ -1,7 +1,9 @@ package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group; import lombok.*; -import java.util.*; + +import java.time.LocalDateTime; + import io.swagger.annotations.*; @ApiModel("管理后台 - 用户组 Response VO") @@ -14,6 +16,6 @@ public class BpmUserGroupRespVO extends BpmUserGroupBaseVO { private Long id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageItemRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageItemRespVO.java index 7442b5ab0..10d23892e 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageItemRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageItemRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程模型的分页的每一项 Response VO") @Data @@ -21,7 +21,7 @@ public class BpmModelPageItemRespVO extends BpmModelBaseVO { private String formName; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; /** * 最新部署的流程定义 @@ -39,7 +39,7 @@ public class BpmModelPageItemRespVO extends BpmModelBaseVO { private Integer version; @ApiModelProperty(value = "部署时间", required = true) - private Date deploymentTime; + private LocalDateTime deploymentTime; @ApiModelProperty(value = "中断状态", required = true, example = "1", notes = "参见 SuspensionState 枚举") private Integer suspensionState; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java index bce0f9100..571850ff0 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程模型的创建 Request VO") @Data @@ -21,6 +21,6 @@ public class BpmModelRespVO extends BpmModelBaseVO { private String bpmnXml; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageItemRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageItemRespVO.java index 75990f08a..1952e95a7 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageItemRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageItemRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程定义的分页的每一项 Response VO") @Data @@ -18,6 +18,6 @@ public class BpmProcessDefinitionPageItemRespVO extends BpmProcessDefinitionResp private String formName; @ApiModelProperty(value = "部署时间", required = true) - private Date deploymentTime; + private LocalDateTime deploymentTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveBaseVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveBaseVO.java index cbc568a11..b8b38c6f2 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveBaseVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveBaseVO.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo; import lombok.*; -import java.util.*; +import java.time.LocalDateTime; import io.swagger.annotations.*; import javax.validation.constraints.*; import org.springframework.format.annotation.DateTimeFormat; @@ -18,11 +18,11 @@ public class BpmOALeaveBaseVO { @ApiModelProperty(value = "请假的开始时间", required = true) @NotNull(message = "开始时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date startTime; + private LocalDateTime startTime; @ApiModelProperty(value = "请假的结束时间", required = true) @NotNull(message = "结束时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "请假类型", required = true, example = "1", notes = "参见 bpm_oa_type 枚举") private Integer type; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java index 2ebab63e9..8ccb6807f 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java @@ -15,7 +15,7 @@ public class BpmOALeaveCreateReqVO extends BpmOALeaveBaseVO { @AssertTrue(message = "结束时间,需要在开始时间之后") public boolean isEndTimeValid() { - return !getEndTime().before(getStartTime()); + return !getEndTime().isBefore(getStartTime()); } } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeavePageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeavePageReqVO.java index 2e49efaa1..38dc5148f 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeavePageReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeavePageReqVO.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo; import lombok.*; -import java.util.*; +import java.time.LocalDateTime; import io.swagger.annotations.*; import cn.iocoder.yudao.framework.common.pojo.PageParam; import org.springframework.format.annotation.DateTimeFormat; @@ -25,6 +25,6 @@ public class BpmOALeavePageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "申请时间") - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java index 908c48e06..42b3ec66c 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java @@ -5,7 +5,7 @@ import io.swagger.annotations.*; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -24,7 +24,7 @@ public class BpmOALeaveRespVO extends BpmOALeaveBaseVO { @ApiModelProperty(value = "申请时间", required = true) @NotNull(message = "申请时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "流程id") private String processInstanceId; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/activity/BpmActivityRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/activity/BpmActivityRespVO.java index ef9d11ac1..7f183f50c 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/activity/BpmActivityRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/activity/BpmActivityRespVO.java @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程活动的 Response VO") @Data @@ -16,9 +16,9 @@ public class BpmActivityRespVO { private String type; @ApiModelProperty(value = "流程活动的开始时间", required = true) - private Date startTime; + private LocalDateTime startTime; @ApiModelProperty(value = "流程活动的结束时间", required = true) - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "关联的流程任务的编号", example = "2048", notes = "关联的流程任务,只有 UserTask 等类型才有") private String taskId; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceMyPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceMyPageReqVO.java index db297e268..e52d45f44 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceMyPageReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceMyPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -35,6 +35,6 @@ public class BpmProcessInstanceMyPageReqVO extends PageParam { @ApiModelProperty(value = "创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstancePageItemRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstancePageItemRespVO.java index 5b5d5797a..0d2534b53 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstancePageItemRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstancePageItemRespVO.java @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; @ApiModel("管理后台 - 流程实例的分页 Item Response VO") @@ -30,10 +30,10 @@ public class BpmProcessInstancePageItemRespVO { private Integer result; @ApiModelProperty(value = "提交时间", required = true) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "结束时间", required = true) - private Date endTime; + private LocalDateTime endTime; /** * 当前任务 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceRespVO.java index a1547b175..58374dae2 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceRespVO.java @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -28,10 +28,10 @@ public class BpmProcessInstanceRespVO { private Integer result; @ApiModelProperty(value = "提交时间", required = true) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "结束时间", required = true) - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "提交的表单值", required = true) private Map formVariables; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageItemRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageItemRespVO.java index c5e2c23ae..a9bb93f9e 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageItemRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageItemRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程任务的 Done 已完成的分页项 Response VO") @Data @@ -15,7 +15,7 @@ import java.util.Date; public class BpmTaskDonePageItemRespVO extends BpmTaskTodoPageItemRespVO { @ApiModelProperty(value = "结束时间", required = true) - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "持续时间", required = true, example = "1000") private Long durationInMillis; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageReqVO.java index 99145b434..a347d58fe 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskDonePageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -23,10 +23,10 @@ public class BpmTaskDonePageReqVO extends PageParam { @ApiModelProperty(value = "开始的创建收间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginCreateTime; + private LocalDateTime beginCreateTime; @ApiModelProperty(value = "结束的创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endCreateTime; + private LocalDateTime endCreateTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageItemRespVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageItemRespVO.java index e25e3aa49..5c2cbf26a 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageItemRespVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageItemRespVO.java @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 流程任务的 Running 进行中的分页项 Response VO") @Data @@ -17,10 +17,10 @@ public class BpmTaskTodoPageItemRespVO { private String name; @ApiModelProperty(value = "接收时间", required = true) - private Date claimTime; + private LocalDateTime claimTime; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "激活状态", required = true, example = "1", notes = "参见 SuspensionState 枚举") private Integer suspensionState; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageReqVO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageReqVO.java index 9f248e198..9d2ad18c2 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageReqVO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/task/BpmTaskTodoPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -23,10 +23,10 @@ public class BpmTaskTodoPageReqVO extends PageParam { @ApiModelProperty(value = "开始的创建收间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginCreateTime; + private LocalDateTime beginCreateTime; @ApiModelProperty(value = "结束的创建时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endCreateTime; + private LocalDateTime endCreateTime; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java index 4d1b2a003..d93b2eee3 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmModelConvert.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.bpm.convert.definition; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.model.*; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; @@ -44,7 +45,7 @@ public interface BpmModelConvert { default BpmModelPageItemRespVO convert(Model model, BpmFormDO form, Deployment deployment, ProcessDefinition processDefinition) { BpmModelPageItemRespVO modelRespVO = new BpmModelPageItemRespVO(); modelRespVO.setId(model.getId()); - modelRespVO.setCreateTime(model.getCreateTime()); + modelRespVO.setCreateTime(DateUtils.dateToLocalDateTime(model.getCreateTime())); // 通用 copy copyTo(model, modelRespVO); // Form @@ -57,7 +58,7 @@ public interface BpmModelConvert { if (modelRespVO.getProcessDefinition() != null) { modelRespVO.getProcessDefinition().setSuspensionState(processDefinition.isSuspended() ? SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode()); - modelRespVO.getProcessDefinition().setDeploymentTime(deployment.getDeploymentTime()); + modelRespVO.getProcessDefinition().setDeploymentTime(DateUtils.dateToLocalDateTime(deployment.getDeploymentTime())); } return modelRespVO; } @@ -65,7 +66,7 @@ public interface BpmModelConvert { default BpmModelRespVO convert(Model model) { BpmModelRespVO modelRespVO = new BpmModelRespVO(); modelRespVO.setId(model.getId()); - modelRespVO.setCreateTime(model.getCreateTime()); + modelRespVO.setCreateTime(DateUtils.dateToLocalDateTime(model.getCreateTime())); // 通用 copy copyTo(model, modelRespVO); return modelRespVO; diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java index 8f5bfcd26..b52b48ee9 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/definition/BpmProcessDefinitionConvert.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.bpm.convert.definition; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionPageItemRespVO; import cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.process.BpmProcessDefinitionRespVO; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmFormDO; @@ -67,7 +69,7 @@ public interface BpmProcessDefinitionConvert { BpmProcessDefinitionPageItemRespVO respVO = convert(bean); respVO.setSuspensionState(bean.isSuspended() ? SuspensionState.SUSPENDED.getStateCode() : SuspensionState.ACTIVE.getStateCode()); if (deployment != null) { - respVO.setDeploymentTime(deployment.getDeploymentTime()); + respVO.setDeploymentTime(LocalDateTimeUtil.of(deployment.getDeploymentTime())); } if (form != null) { respVO.setFormName(form.getName()); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java index 91d405925..a4ba5cc85 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/convert/task/BpmTaskConvert.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.bpm.convert.task; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.number.NumberUtils; import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskDonePageItemRespVO; @@ -151,7 +152,7 @@ public interface BpmTaskConvert { BpmTaskExtDO taskExtDO = new BpmTaskExtDO().setTaskId(task.getId()) .setAssigneeUserId(NumberUtils.parseLong(task.getAssignee())).setName(task.getName()) .setProcessDefinitionId(task.getProcessDefinitionId()).setProcessInstanceId(task.getProcessInstanceId()); - taskExtDO.setCreateTime(task.getCreateTime()); + taskExtDO.setCreateTime(LocalDateTimeUtil.of(task.getCreateTime())); return taskExtDO; } diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/BpmOALeaveDO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/BpmOALeaveDO.java index 31381a556..e4fbc1dea 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/BpmOALeaveDO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/oa/BpmOALeaveDO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.bpm.dal.dataobject.oa; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; import lombok.*; -import java.util.*; +import java.time.LocalDateTime; import com.baomidou.mybatisplus.annotation.*; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; @@ -46,11 +46,11 @@ public class BpmOALeaveDO extends BaseDO { /** * 开始时间 */ - private Date startTime; + private LocalDateTime startTime; /** * 结束时间 */ - private Date endTime; + private LocalDateTime endTime; /** * 请假天数 */ diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmActivityDO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmActivityDO.java index 183a04147..02e67e8d3 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmActivityDO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmActivityDO.java @@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import lombok.*; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; @@ -80,18 +80,18 @@ public class BpmActivityDO { */ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date startTime; + private LocalDateTime startTime; /** * 任务结束时间 */ @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) - private Date endTime; + private LocalDateTime endTime; private Integer transactionOrder; - private Long duration; + private LocalDateTime duration; /** * 删除结果 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmProcessInstanceExtDO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmProcessInstanceExtDO.java index b37709962..293cc2dd7 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmProcessInstanceExtDO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmProcessInstanceExtDO.java @@ -11,7 +11,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; import java.util.Map; /** @@ -79,7 +79,7 @@ public class BpmProcessInstanceExtDO extends BaseDO { * * 冗余 HistoricProcessInstance 的 endTime 属性 */ - private Date endTime; + private LocalDateTime endTime; /** * 提交的表单值 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmTaskExtDO.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmTaskExtDO.java index 5c6b70fc3..a79fce412 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmTaskExtDO.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/dal/dataobject/task/BpmTaskExtDO.java @@ -8,7 +8,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; /** * Bpm 流程任务的拓展表 @@ -67,7 +67,7 @@ public class BpmTaskExtDO extends BaseDO { * * 冗余 HistoricTaskInstance 的 endTime 属性 */ - private Date endTime; + private LocalDateTime endTime; /** * 流程实例的编号 diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/BpmOALeaveServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/BpmOALeaveServiceImpl.java index d0aadd95e..16f50aacf 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/BpmOALeaveServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/oa/BpmOALeaveServiceImpl.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.bpm.service.oa; -import cn.hutool.core.date.DateUtil; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.bpm.api.task.BpmProcessInstanceApi; import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; @@ -46,7 +46,7 @@ public class BpmOALeaveServiceImpl implements BpmOALeaveService { @Transactional(rollbackFor = Exception.class) public Long createLeave(Long userId, BpmOALeaveCreateReqVO createReqVO) { // 插入 OA 请假单 - long day = DateUtil.betweenDay(createReqVO.getStartTime(), createReqVO.getEndTime(), false); + long day = LocalDateTimeUtil.between(createReqVO.getStartTime(), createReqVO.getEndTime()).toDays(); BpmOALeaveDO leave = BpmOALeaveConvert.INSTANCE.convert(createReqVO).setUserId(userId).setDay(day) .setResult(BpmProcessInstanceResultEnum.PROCESS.getResult()); leaveMapper.insert(leave); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java index a248ca458..bb027d80e 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmProcessInstanceServiceImpl.java @@ -1 +1 @@ -package cn.iocoder.yudao.module.bpm.service.task; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.number.NumberUtils; import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*; import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO; import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO; import cn.iocoder.yudao.module.bpm.dal.mysql.task.BpmProcessInstanceExtMapper; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceDeleteReasonEnum; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum; import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventPublisher; import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService; import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import lombok.extern.slf4j.Slf4j; import org.flowable.engine.HistoryService; import org.flowable.engine.RuntimeService; import org.flowable.engine.delegate.event.FlowableCancelledEvent; import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.task.api.Task; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import javax.validation.Valid; import java.util.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; /** * 流程实例 Service 实现类 * * ProcessDefinition & ProcessInstance & Execution & Task 的关系: * 1. * * HistoricProcessInstance & ProcessInstance 的关系: * 1. * * 简单来说,前者 = 历史 + 运行中的流程实例,后者仅是运行中的流程实例 * * @author 芋道源码 */ @Service @Validated @Slf4j public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService { @Resource private RuntimeService runtimeService; @Resource private BpmProcessInstanceExtMapper processInstanceExtMapper; @Resource @Lazy // 解决循环依赖 private BpmTaskService taskService; @Resource private BpmProcessDefinitionService processDefinitionService; @Resource private HistoryService historyService; @Resource private AdminUserApi adminUserApi; @Resource private DeptApi deptApi; @Resource private BpmProcessInstanceResultEventPublisher processInstanceResultEventPublisher; @Resource private BpmMessageService messageService; @Override public ProcessInstance getProcessInstance(String id) { return runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult(); } @Override public List getProcessInstances(Set ids) { return runtimeService.createProcessInstanceQuery().processInstanceIds(ids).list(); } @Override public PageResult getMyProcessInstancePage(Long userId, BpmProcessInstanceMyPageReqVO pageReqVO) { // 通过 BpmProcessInstanceExtDO 表,先查询到对应的分页 PageResult pageResult = processInstanceExtMapper.selectPage(userId, pageReqVO); if (CollUtil.isEmpty(pageResult.getList())) { return new PageResult<>(pageResult.getTotal()); } // 获得流程 Task Map List processInstanceIds = convertList(pageResult.getList(), BpmProcessInstanceExtDO::getProcessInstanceId); Map> taskMap = taskService.getTaskMapByProcessInstanceIds(processInstanceIds); // 转换返回 return BpmProcessInstanceConvert.INSTANCE.convertPage(pageResult, taskMap); } @Override @Transactional(rollbackFor = Exception.class) public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqVO createReqVO) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getProcessDefinition(createReqVO.getProcessDefinitionId()); // 发起流程 return createProcessInstance0(userId, definition, createReqVO.getVariables(), null); } @Override public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO createReqDTO) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getActiveProcessDefinition(createReqDTO.getProcessDefinitionKey()); // 发起流程 return createProcessInstance0(userId, definition, createReqDTO.getVariables(), createReqDTO.getBusinessKey()); } @Override public BpmProcessInstanceRespVO getProcessInstanceVO(String id) { // 获得流程实例 HistoricProcessInstance processInstance = getHistoricProcessInstance(id); if (processInstance == null) { return null; } BpmProcessInstanceExtDO processInstanceExt = processInstanceExtMapper.selectByProcessInstanceId(id); Assert.notNull(processInstanceExt, "流程实例拓展({}) 不存在", id); // 获得流程定义 ProcessDefinition processDefinition = processDefinitionService .getProcessDefinition(processInstance.getProcessDefinitionId()); Assert.notNull(processDefinition, "流程定义({}) 不存在", processInstance.getProcessDefinitionId()); BpmProcessDefinitionExtDO processDefinitionExt = processDefinitionService.getProcessDefinitionExt( processInstance.getProcessDefinitionId()); Assert.notNull(processDefinitionExt, "流程定义拓展({}) 不存在", id); String bpmnXml = processDefinitionService.getProcessDefinitionBpmnXML(processInstance.getProcessDefinitionId()); // 获得 User AdminUserRespDTO startUser = adminUserApi.getUser(NumberUtils.parseLong(processInstance.getStartUserId())); DeptRespDTO dept = null; if (startUser != null) { dept = deptApi.getDept(startUser.getDeptId()); } // 拼接结果 return BpmProcessInstanceConvert.INSTANCE.convert2(processInstance, processInstanceExt, processDefinition, processDefinitionExt, bpmnXml, startUser, dept); } @Override public void cancelProcessInstance(Long userId, @Valid BpmProcessInstanceCancelReqVO cancelReqVO) { // 校验流程实例存在 ProcessInstance instance = getProcessInstance(cancelReqVO.getId()); if (instance == null) { throw exception(PROCESS_INSTANCE_CANCEL_FAIL_NOT_EXISTS); } // 只能取消自己的 if (!Objects.equals(instance.getStartUserId(), String.valueOf(userId))) { throw exception(PROCESS_INSTANCE_CANCEL_FAIL_NOT_SELF); } // 通过删除流程实例,实现流程实例的取消, // 删除流程实例,正则执行任务 ACT_RU_TASK. 任务会被删除。通过历史表查询 deleteProcessInstance(cancelReqVO.getId(), BpmProcessInstanceDeleteReasonEnum.CANCEL_TASK.format(cancelReqVO.getReason())); } /** * 获得历史的流程实例 * * @param id 流程实例的编号 * @return 历史的流程实例 */ @Override public HistoricProcessInstance getHistoricProcessInstance(String id) { return historyService.createHistoricProcessInstanceQuery().processInstanceId(id).singleResult(); } @Override public List getHistoricProcessInstances(Set ids) { return historyService.createHistoricProcessInstanceQuery().processInstanceIds(ids).list(); } @Override public void createProcessInstanceExt(ProcessInstance instance) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getProcessDefinition2(instance.getProcessDefinitionId()); // 插入 BpmProcessInstanceExtDO 对象 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(instance.getId()) .setProcessDefinitionId(definition.getId()) .setName(instance.getProcessDefinitionName()) .setStartUserId(Long.valueOf(instance.getStartUserId())) .setCategory(definition.getCategory()) .setStatus(BpmProcessInstanceStatusEnum.RUNNING.getStatus()) .setResult(BpmProcessInstanceResultEnum.PROCESS.getResult()); processInstanceExtMapper.insert(instanceExtDO); } @Override public void updateProcessInstanceExtCancel(FlowableCancelledEvent event) { // 判断是否为 Reject 不通过。如果是,则不进行更新. // 因为,updateProcessInstanceExtReject 方法,已经进行更新了 if (BpmProcessInstanceDeleteReasonEnum.isRejectReason((String)event.getCause())) { return; } // 需要主动查询,因为 instance 只有 id 属性 // 另外,此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance HistoricProcessInstance processInstance = getHistoricProcessInstance(event.getProcessInstanceId()); // 更新拓展表 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(event.getProcessInstanceId()) .setEndTime(new Date()) // 由于 ProcessInstance 里没有办法拿到 endTime,所以这里设置 .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.CANCEL.getResult()); processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } @Override public void updateProcessInstanceExtComplete(ProcessInstance instance) { // 需要主动查询,因为 instance 只有 id 属性 // 另外,此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance HistoricProcessInstance processInstance = getHistoricProcessInstance(instance.getId()); // 更新拓展表 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(instance.getProcessInstanceId()) .setEndTime(new Date()) // 由于 ProcessInstance 里没有办法拿到 endTime,所以这里设置 .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.APPROVE.getResult()); // 如果正常完全,说明审批通过 processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程被通过的消息 messageService.sendMessageWhenProcessInstanceApprove(BpmProcessInstanceConvert.INSTANCE.convert2ApprovedReq(instance)); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } @Transactional(rollbackFor = Exception.class) public void updateProcessInstanceExtReject(String id, String reason) { // 需要主动查询,因为 instance 只有 id 属性 ProcessInstance processInstance = getProcessInstance(id); // 删除流程实例,以实现驳回任务时,取消整个审批流程 deleteProcessInstance(id, StrUtil.format(BpmProcessInstanceDeleteReasonEnum.REJECT_TASK.format(reason))); // 更新 status + result // 注意,不能和上面的逻辑更换位置。因为 deleteProcessInstance 会触发流程的取消,进而调用 updateProcessInstanceExtCancel 方法, // 设置 result 为 BpmProcessInstanceStatusEnum.CANCEL,显然和 result 不一定是一致的 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO().setProcessInstanceId(id) .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.REJECT.getResult()); processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程被不通过的消息 messageService.sendMessageWhenProcessInstanceReject(BpmProcessInstanceConvert.INSTANCE.convert2RejectReq(processInstance, reason)); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } private void deleteProcessInstance(String id, String reason) { runtimeService.deleteProcessInstance(id, reason); } private String createProcessInstance0(Long userId, ProcessDefinition definition, Map variables, String businessKey) { // 校验流程定义 if (definition == null) { throw exception(PROCESS_DEFINITION_NOT_EXISTS); } if (definition.isSuspended()) { throw exception(PROCESS_DEFINITION_IS_SUSPENDED); } // 创建流程实例 ProcessInstance instance = runtimeService.startProcessInstanceById(definition.getId(), businessKey, variables); // 设置流程名字 runtimeService.setProcessInstanceName(instance.getId(), definition.getName()); // 补全流程实例的拓展表 processInstanceExtMapper.updateByProcessInstanceId(new BpmProcessInstanceExtDO().setProcessInstanceId(instance.getId()) .setFormVariables(variables)); return instance.getId(); } } \ No newline at end of file +package cn.iocoder.yudao.module.bpm.service.task; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.number.NumberUtils; import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO; import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.*; import cn.iocoder.yudao.module.bpm.convert.task.BpmProcessInstanceConvert; import cn.iocoder.yudao.module.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO; import cn.iocoder.yudao.module.bpm.dal.dataobject.task.BpmProcessInstanceExtDO; import cn.iocoder.yudao.module.bpm.dal.mysql.task.BpmProcessInstanceExtMapper; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceDeleteReasonEnum; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceResultEnum; import cn.iocoder.yudao.module.bpm.enums.task.BpmProcessInstanceStatusEnum; import cn.iocoder.yudao.module.bpm.framework.bpm.core.event.BpmProcessInstanceResultEventPublisher; import cn.iocoder.yudao.module.bpm.service.definition.BpmProcessDefinitionService; import cn.iocoder.yudao.module.bpm.service.message.BpmMessageService; import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import lombok.extern.slf4j.Slf4j; import org.flowable.engine.HistoryService; import org.flowable.engine.RuntimeService; import org.flowable.engine.delegate.event.FlowableCancelledEvent; import org.flowable.engine.history.HistoricProcessInstance; import org.flowable.engine.repository.ProcessDefinition; import org.flowable.engine.runtime.ProcessInstance; import org.flowable.task.api.Task; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import javax.validation.Valid; import java.time.LocalDateTime; import java.util.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.*; /** * 流程实例 Service 实现类 * * ProcessDefinition & ProcessInstance & Execution & Task 的关系: * 1. * * HistoricProcessInstance & ProcessInstance 的关系: * 1. * * 简单来说,前者 = 历史 + 运行中的流程实例,后者仅是运行中的流程实例 * * @author 芋道源码 */ @Service @Validated @Slf4j public class BpmProcessInstanceServiceImpl implements BpmProcessInstanceService { @Resource private RuntimeService runtimeService; @Resource private BpmProcessInstanceExtMapper processInstanceExtMapper; @Resource @Lazy // 解决循环依赖 private BpmTaskService taskService; @Resource private BpmProcessDefinitionService processDefinitionService; @Resource private HistoryService historyService; @Resource private AdminUserApi adminUserApi; @Resource private DeptApi deptApi; @Resource private BpmProcessInstanceResultEventPublisher processInstanceResultEventPublisher; @Resource private BpmMessageService messageService; @Override public ProcessInstance getProcessInstance(String id) { return runtimeService.createProcessInstanceQuery().processInstanceId(id).singleResult(); } @Override public List getProcessInstances(Set ids) { return runtimeService.createProcessInstanceQuery().processInstanceIds(ids).list(); } @Override public PageResult getMyProcessInstancePage(Long userId, BpmProcessInstanceMyPageReqVO pageReqVO) { // 通过 BpmProcessInstanceExtDO 表,先查询到对应的分页 PageResult pageResult = processInstanceExtMapper.selectPage(userId, pageReqVO); if (CollUtil.isEmpty(pageResult.getList())) { return new PageResult<>(pageResult.getTotal()); } // 获得流程 Task Map List processInstanceIds = convertList(pageResult.getList(), BpmProcessInstanceExtDO::getProcessInstanceId); Map> taskMap = taskService.getTaskMapByProcessInstanceIds(processInstanceIds); // 转换返回 return BpmProcessInstanceConvert.INSTANCE.convertPage(pageResult, taskMap); } @Override @Transactional(rollbackFor = Exception.class) public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqVO createReqVO) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getProcessDefinition(createReqVO.getProcessDefinitionId()); // 发起流程 return createProcessInstance0(userId, definition, createReqVO.getVariables(), null); } @Override public String createProcessInstance(Long userId, @Valid BpmProcessInstanceCreateReqDTO createReqDTO) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getActiveProcessDefinition(createReqDTO.getProcessDefinitionKey()); // 发起流程 return createProcessInstance0(userId, definition, createReqDTO.getVariables(), createReqDTO.getBusinessKey()); } @Override public BpmProcessInstanceRespVO getProcessInstanceVO(String id) { // 获得流程实例 HistoricProcessInstance processInstance = getHistoricProcessInstance(id); if (processInstance == null) { return null; } BpmProcessInstanceExtDO processInstanceExt = processInstanceExtMapper.selectByProcessInstanceId(id); Assert.notNull(processInstanceExt, "流程实例拓展({}) 不存在", id); // 获得流程定义 ProcessDefinition processDefinition = processDefinitionService .getProcessDefinition(processInstance.getProcessDefinitionId()); Assert.notNull(processDefinition, "流程定义({}) 不存在", processInstance.getProcessDefinitionId()); BpmProcessDefinitionExtDO processDefinitionExt = processDefinitionService.getProcessDefinitionExt( processInstance.getProcessDefinitionId()); Assert.notNull(processDefinitionExt, "流程定义拓展({}) 不存在", id); String bpmnXml = processDefinitionService.getProcessDefinitionBpmnXML(processInstance.getProcessDefinitionId()); // 获得 User AdminUserRespDTO startUser = adminUserApi.getUser(NumberUtils.parseLong(processInstance.getStartUserId())); DeptRespDTO dept = null; if (startUser != null) { dept = deptApi.getDept(startUser.getDeptId()); } // 拼接结果 return BpmProcessInstanceConvert.INSTANCE.convert2(processInstance, processInstanceExt, processDefinition, processDefinitionExt, bpmnXml, startUser, dept); } @Override public void cancelProcessInstance(Long userId, @Valid BpmProcessInstanceCancelReqVO cancelReqVO) { // 校验流程实例存在 ProcessInstance instance = getProcessInstance(cancelReqVO.getId()); if (instance == null) { throw exception(PROCESS_INSTANCE_CANCEL_FAIL_NOT_EXISTS); } // 只能取消自己的 if (!Objects.equals(instance.getStartUserId(), String.valueOf(userId))) { throw exception(PROCESS_INSTANCE_CANCEL_FAIL_NOT_SELF); } // 通过删除流程实例,实现流程实例的取消, // 删除流程实例,正则执行任务 ACT_RU_TASK. 任务会被删除。通过历史表查询 deleteProcessInstance(cancelReqVO.getId(), BpmProcessInstanceDeleteReasonEnum.CANCEL_TASK.format(cancelReqVO.getReason())); } /** * 获得历史的流程实例 * * @param id 流程实例的编号 * @return 历史的流程实例 */ @Override public HistoricProcessInstance getHistoricProcessInstance(String id) { return historyService.createHistoricProcessInstanceQuery().processInstanceId(id).singleResult(); } @Override public List getHistoricProcessInstances(Set ids) { return historyService.createHistoricProcessInstanceQuery().processInstanceIds(ids).list(); } @Override public void createProcessInstanceExt(ProcessInstance instance) { // 获得流程定义 ProcessDefinition definition = processDefinitionService.getProcessDefinition2(instance.getProcessDefinitionId()); // 插入 BpmProcessInstanceExtDO 对象 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(instance.getId()) .setProcessDefinitionId(definition.getId()) .setName(instance.getProcessDefinitionName()) .setStartUserId(Long.valueOf(instance.getStartUserId())) .setCategory(definition.getCategory()) .setStatus(BpmProcessInstanceStatusEnum.RUNNING.getStatus()) .setResult(BpmProcessInstanceResultEnum.PROCESS.getResult()); processInstanceExtMapper.insert(instanceExtDO); } @Override public void updateProcessInstanceExtCancel(FlowableCancelledEvent event) { // 判断是否为 Reject 不通过。如果是,则不进行更新. // 因为,updateProcessInstanceExtReject 方法,已经进行更新了 if (BpmProcessInstanceDeleteReasonEnum.isRejectReason((String)event.getCause())) { return; } // 需要主动查询,因为 instance 只有 id 属性 // 另外,此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance HistoricProcessInstance processInstance = getHistoricProcessInstance(event.getProcessInstanceId()); // 更新拓展表 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(event.getProcessInstanceId()) .setEndTime(LocalDateTime.now()) // 由于 ProcessInstance 里没有办法拿到 endTime,所以这里设置 .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.CANCEL.getResult()); processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } @Override public void updateProcessInstanceExtComplete(ProcessInstance instance) { // 需要主动查询,因为 instance 只有 id 属性 // 另外,此时如果去查询 ProcessInstance 的话,字段是不全的,所以去查询了 HistoricProcessInstance HistoricProcessInstance processInstance = getHistoricProcessInstance(instance.getId()); // 更新拓展表 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO() .setProcessInstanceId(instance.getProcessInstanceId()) .setEndTime(LocalDateTime.now()) // 由于 ProcessInstance 里没有办法拿到 endTime,所以这里设置 .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.APPROVE.getResult()); // 如果正常完全,说明审批通过 processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程被通过的消息 messageService.sendMessageWhenProcessInstanceApprove(BpmProcessInstanceConvert.INSTANCE.convert2ApprovedReq(instance)); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } @Transactional(rollbackFor = Exception.class) public void updateProcessInstanceExtReject(String id, String reason) { // 需要主动查询,因为 instance 只有 id 属性 ProcessInstance processInstance = getProcessInstance(id); // 删除流程实例,以实现驳回任务时,取消整个审批流程 deleteProcessInstance(id, StrUtil.format(BpmProcessInstanceDeleteReasonEnum.REJECT_TASK.format(reason))); // 更新 status + result // 注意,不能和上面的逻辑更换位置。因为 deleteProcessInstance 会触发流程的取消,进而调用 updateProcessInstanceExtCancel 方法, // 设置 result 为 BpmProcessInstanceStatusEnum.CANCEL,显然和 result 不一定是一致的 BpmProcessInstanceExtDO instanceExtDO = new BpmProcessInstanceExtDO().setProcessInstanceId(id) .setStatus(BpmProcessInstanceStatusEnum.FINISH.getStatus()) .setResult(BpmProcessInstanceResultEnum.REJECT.getResult()); processInstanceExtMapper.updateByProcessInstanceId(instanceExtDO); // 发送流程被不通过的消息 messageService.sendMessageWhenProcessInstanceReject(BpmProcessInstanceConvert.INSTANCE.convert2RejectReq(processInstance, reason)); // 发送流程实例的状态事件 processInstanceResultEventPublisher.sendProcessInstanceResultEvent( BpmProcessInstanceConvert.INSTANCE.convert(this, processInstance, instanceExtDO.getResult())); } private void deleteProcessInstance(String id, String reason) { runtimeService.deleteProcessInstance(id, reason); } private String createProcessInstance0(Long userId, ProcessDefinition definition, Map variables, String businessKey) { // 校验流程定义 if (definition == null) { throw exception(PROCESS_DEFINITION_NOT_EXISTS); } if (definition.isSuspended()) { throw exception(PROCESS_DEFINITION_IS_SUSPENDED); } // 创建流程实例 ProcessInstance instance = runtimeService.startProcessInstanceById(definition.getId(), businessKey, variables); // 设置流程名字 runtimeService.setProcessInstanceName(instance.getId(), definition.getName()); // 补全流程实例的拓展表 processInstanceExtMapper.updateByProcessInstanceId(new BpmProcessInstanceExtDO().setProcessInstanceId(instance.getId()) .setFormVariables(variables)); return instance.getId(); } } \ No newline at end of file diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java index 05ee50a75..534a47e5f 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.bpm.service.task; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.common.util.number.NumberUtils; import cn.iocoder.yudao.framework.common.util.object.PageUtils; import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.*; @@ -32,6 +33,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager import javax.annotation.Resource; import javax.validation.Valid; +import java.time.LocalDateTime; import java.util.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; @@ -74,10 +76,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { taskQuery.taskNameLike("%" + pageVO.getName() + "%"); } if (pageVO.getBeginCreateTime() != null) { - taskQuery.taskCreatedAfter(pageVO.getBeginCreateTime()); + taskQuery.taskCreatedAfter(DateUtils.localDateTimeToDate(pageVO.getBeginCreateTime())); } if (pageVO.getEndCreateTime() != null) { - taskQuery.taskCreatedBefore(pageVO.getEndCreateTime()); + taskQuery.taskCreatedBefore(DateUtils.localDateTimeToDate(pageVO.getEndCreateTime())); } // 执行查询 List tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); @@ -106,10 +108,10 @@ public class BpmTaskServiceImpl implements BpmTaskService { taskQuery.taskNameLike("%" + pageVO.getName() + "%"); } if (pageVO.getBeginCreateTime() != null) { - taskQuery.taskCreatedAfter(pageVO.getBeginCreateTime()); + taskQuery.taskCreatedAfter(DateUtils.localDateTimeToDate(pageVO.getBeginCreateTime())); } if (pageVO.getEndCreateTime() != null) { - taskQuery.taskCreatedBefore(pageVO.getEndCreateTime()); + taskQuery.taskCreatedBefore(DateUtils.localDateTimeToDate(pageVO.getEndCreateTime())); } // 执行查询 List tasks = taskQuery.listPage(PageUtils.getStart(pageVO), pageVO.getPageSize()); @@ -205,7 +207,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { // 更新任务拓展表为不通过 taskExtMapper.updateByTaskId( new BpmTaskExtDO().setTaskId(task.getId()).setResult(BpmProcessInstanceResultEnum.REJECT.getResult()) - .setEndTime(new Date()).setReason(reqVO.getReason())); + .setEndTime(LocalDateTime.now()).setReason(reqVO.getReason())); } @Override @@ -249,7 +251,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { public void updateTaskExtComplete(Task task) { BpmTaskExtDO taskExtDO = BpmTaskConvert.INSTANCE.convert2TaskExt(task) .setResult(BpmProcessInstanceResultEnum.APPROVE.getResult()) // 不设置也问题不大,因为 Complete 一般是审核通过,已经设置 - .setEndTime(new Date()); + .setEndTime(LocalDateTime.now()); taskExtMapper.updateByTaskId(taskExtDO); } @@ -280,7 +282,7 @@ public class BpmTaskServiceImpl implements BpmTaskService { // 更新任务 taskExtMapper.updateById(new BpmTaskExtDO().setId(taskExt.getId()).setResult(BpmProcessInstanceResultEnum.CANCEL.getResult()) - .setEndTime(new Date()).setReason(BpmProcessInstanceDeleteReasonEnum.translateReason(task.getDeleteReason()))); + .setEndTime(LocalDateTime.now()).setReason(BpmProcessInstanceDeleteReasonEnum.translateReason(task.getDeleteReason()))); } }); diff --git a/yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/definition/BpmUserGroupServiceTest.java b/yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/definition/BpmUserGroupServiceTest.java index 1053c95e1..de62eb28a 100644 --- a/yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/definition/BpmUserGroupServiceTest.java +++ b/yudao-module-bpm/yudao-module-bpm-biz/src/test/java/cn/iocoder/yudao/module/bpm/service/definition/BpmUserGroupServiceTest.java @@ -17,9 +17,9 @@ import org.springframework.context.annotation.Import; import javax.annotation.Resource; -import java.util.Date; +import java.time.LocalDateTime; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildLocalDateTime; import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId; import static cn.iocoder.yudao.module.bpm.enums.ErrorCodeConstants.USER_GROUP_NOT_EXISTS; @@ -106,7 +106,7 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest { BpmUserGroupDO dbUserGroup = RandomUtils.randomPojo(BpmUserGroupDO.class, o -> { // 等会查询到 o.setName("芋道源码"); o.setStatus(CommonStatusEnum.ENABLE.getStatus()); - o.setCreateTime(DateUtils.buildTime(2021, 11, 11)); + o.setCreateTime(DateUtils.buildLocalDateTime(2021, 11, 11)); }); userGroupMapper.insert(dbUserGroup); // 测试 name 不匹配 @@ -114,12 +114,12 @@ public class BpmUserGroupServiceTest extends BaseDbUnitTest { // 测试 status 不匹配 userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setStatus(CommonStatusEnum.DISABLE.getStatus()))); // 测试 createTime 不匹配 - userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setCreateTime(DateUtils.buildTime(2021, 12, 12)))); + userGroupMapper.insert(cloneIgnoreId(dbUserGroup, o -> o.setCreateTime(DateUtils.buildLocalDateTime(2021, 12, 12)))); // 准备参数 BpmUserGroupPageReqVO reqVO = new BpmUserGroupPageReqVO(); reqVO.setName("源码"); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); - reqVO.setCreateTime((new Date[]{buildTime(2021, 11, 10),buildTime(2021, 11, 12)})); + reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2021, 11, 10),buildLocalDateTime(2021, 11, 12)})); // 调用 PageResult pageResult = userGroupService.getUserGroupPage(reqVO); diff --git a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiAccessLogCreateReqDTO.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiAccessLogCreateReqDTO.java index 0ad0ea79c..a284cf395 100644 --- a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiAccessLogCreateReqDTO.java +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiAccessLogCreateReqDTO.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.infra.api.logger.dto; import lombok.Data; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; /** * API 访问日志 @@ -61,12 +61,12 @@ public class ApiAccessLogCreateReqDTO { * 开始请求时间 */ @NotNull(message = "开始请求时间不能为空") - private Date beginTime; + private LocalDateTime beginTime; /** * 结束请求时间 */ @NotNull(message = "结束请求时间不能为空") - private Date endTime; + private LocalDateTime endTime; /** * 执行时长,单位:毫秒 */ diff --git a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiErrorLogCreateReqDTO.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiErrorLogCreateReqDTO.java index c2d555703..6b1cc8ecb 100644 --- a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiErrorLogCreateReqDTO.java +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/logger/dto/ApiErrorLogCreateReqDTO.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.infra.api.logger.dto; import lombok.Data; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; /** * API 错误日志 @@ -61,7 +61,7 @@ public class ApiErrorLogCreateReqDTO { * 异常时间 */ @NotNull(message = "异常时间不能为空") - private Date exceptionTime; + private LocalDateTime exceptionTime; /** * 异常名 */ diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnRespVO.java index 36dd3a05c..125b71801 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/column/CodegenColumnRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 代码生成字段定义 Response VO") @Data @@ -18,6 +18,6 @@ public class CodegenColumnRespVO extends CodegenColumnBaseVO { private Long id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java index af15709dc..7a8ff7f31 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTablePageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -26,6 +26,6 @@ public class CodegenTablePageReqVO extends PageParam { @ApiModelProperty(value = "创建时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableRespVO.java index bd1004bc7..7ef96b9a8 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/codegen/vo/table/CodegenTableRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 代码生成表定义 Response VO") @Data @@ -21,9 +21,9 @@ public class CodegenTableRespVO extends CodegenTableBaseVO { private Integer dataSourceConfigId; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "更新时间", required = true) - private Date updateTime; + private LocalDateTime updateTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExcelVO.java index 908981e0a..5780b04cd 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExcelVO.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; /** * 参数配置 Excel 导出响应 VO @@ -41,6 +41,6 @@ public class ConfigExcelVO { private String remark; @ExcelProperty("创建时间") - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExportReqVO.java index 49a2fd5a3..7c679e2d1 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExportReqVO.java @@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -24,6 +24,6 @@ public class ConfigExportReqVO { @ApiModelProperty(value = "创建时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java index 56bb83f69..5ca206d46 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -29,6 +29,6 @@ public class ConfigPageReqVO extends PageParam { @ApiModelProperty(value = "创建时间", example = "[2022-07-01 00:00:00,2022-07-01 23:59:59]") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigRespVO.java index 03196e060..0c952eecb 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigRespVO.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 参数配置信息 Response VO") @Data @@ -26,6 +26,6 @@ public class ConfigRespVO extends ConfigBaseVO { private Integer type; @ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式") - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigRespVO.java index af63aa0dd..dea918764 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/db/vo/DataSourceConfigRespVO.java @@ -1,7 +1,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.db.vo; import lombok.*; -import java.util.*; + +import java.time.LocalDateTime; import io.swagger.annotations.*; @ApiModel("管理后台 - 数据源配置 Response VO") @@ -14,6 +15,6 @@ public class DataSourceConfigRespVO extends DataSourceConfigBaseVO { private Integer id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java index cda182602..07104cba5 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -26,6 +26,6 @@ public class FileConfigPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "创建时间") - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigRespVO.java index 74291925b..c2341e486 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/config/FileConfigRespVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 文件配置 Response VO") @Data @@ -31,6 +31,6 @@ public class FileConfigRespVO extends FileConfigBaseVO { private FileClientConfig config; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java index 65d54f351..0f44f4fc7 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FilePageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -26,6 +26,6 @@ public class FilePageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "创建时间") - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileRespVO.java index 31b790a21..4d5cecc7a 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/file/FileRespVO.java @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel(value = "管理后台 - 文件 Response VO", description = "不返回 content 字段,太大") @Data @@ -32,6 +32,6 @@ public class FileRespVO { private Integer size; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java index 47ef687dd..e3fd84eda 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java @@ -22,9 +22,9 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; +import java.time.LocalDateTime; import java.util.Collection; import java.util.Collections; -import java.util.Date; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -133,8 +133,8 @@ public class JobController { @ApiImplicitParam(name = "count", value = "数量", example = "5", dataTypeClass = Long.class) }) @PreAuthorize("@ss.hasPermission('infra:job:query')") - public CommonResult> getJobNextTimes(@RequestParam("id") Long id, - @RequestParam(value = "count", required = false, defaultValue = "5") Integer count) { + public CommonResult> getJobNextTimes(@RequestParam("id") Long id, + @RequestParam(value = "count", required = false, defaultValue = "5") Integer count) { JobDO job = jobService.getJob(id); if (job == null) { return success(Collections.emptyList()); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExcelVO.java index 6b5a6a0b1..55811ecec 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExcelVO.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; /** * 定时任务 Excel VO @@ -36,21 +36,21 @@ public class JobExcelVO { private String cronExpression; @ExcelProperty("最后一次执行的开始时间") - private Date executeBeginTime; + private LocalDateTime executeBeginTime; @ExcelProperty("最后一次执行的结束时间") - private Date executeEndTime; + private LocalDateTime executeEndTime; @ExcelProperty("上一次触发时间") - private Date firePrevTime; + private LocalDateTime firePrevTime; @ExcelProperty("下一次触发时间") - private Date fireNextTime; + private LocalDateTime fireNextTime; @ExcelProperty("监控超时时间") private Integer monitorTimeout; @ExcelProperty("创建时间") - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java index 586134278..26d7f8d73 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 定时任务 Response VO") @Data @@ -26,6 +26,6 @@ public class JobRespVO extends JobBaseVO { private String handlerName; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogBaseVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogBaseVO.java index 761921349..591c7a699 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogBaseVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogBaseVO.java @@ -5,7 +5,7 @@ import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -34,11 +34,11 @@ public class JobLogBaseVO { @ApiModelProperty(value = "开始执行时间", required = true) @NotNull(message = "开始执行时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginTime; + private LocalDateTime beginTime; @ApiModelProperty(value = "结束执行时间") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "执行时长", example = "123") private Integer duration; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExcelVO.java index 25eed2a3f..e8619d42a 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExcelVO.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; /** * 定时任务 Excel VO @@ -32,10 +32,10 @@ public class JobLogExcelVO { private Integer executeIndex; @ExcelProperty("开始执行时间") - private Date beginTime; + private LocalDateTime beginTime; @ExcelProperty("结束执行时间") - private Date endTime; + private LocalDateTime endTime; @ExcelProperty("执行时长") private Integer duration; @@ -48,6 +48,6 @@ public class JobLogExcelVO { private String result; @ExcelProperty("创建时间") - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExportReqVO.java index df482c9d2..62824739f 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExportReqVO.java @@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -21,11 +21,11 @@ public class JobLogExportReqVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始执行时间") - private Date beginTime; + private LocalDateTime beginTime; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "结束执行时间") - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "任务状态", notes = "参见 JobLogStatusEnum 枚举") private Integer status; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java index 055cfc56c..6a71c4d3e 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -26,11 +26,11 @@ public class JobLogPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始执行时间") - private Date beginTime; + private LocalDateTime beginTime; @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "结束执行时间") - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "任务状态", notes = "参见 JobLogStatusEnum 枚举") private Integer status; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogRespVO.java index c806a209a..611c87b58 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - 定时任务日志 Response VO") @Data @@ -18,6 +18,6 @@ public class JobLogRespVO extends JobLogBaseVO { private Long id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java index 619dea65a..077f26133 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java @@ -5,7 +5,7 @@ import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -54,12 +54,12 @@ public class ApiAccessLogBaseVO { @ApiModelProperty(value = "开始请求时间", required = true) @NotNull(message = "开始请求时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date beginTime; + private LocalDateTime beginTime; @ApiModelProperty(value = "结束请求时间", required = true) @NotNull(message = "结束请求时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date endTime; + private LocalDateTime endTime; @ApiModelProperty(value = "执行时长", required = true, example = "100") @NotNull(message = "执行时长不能为空") diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java index 5c1995c6a..21447743d 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; /** * API 访问日志 Excel VO @@ -48,10 +48,10 @@ public class ApiAccessLogExcelVO { private String userAgent; @ExcelProperty("开始请求时间") - private Date beginTime; + private LocalDateTime beginTime; @ExcelProperty("结束请求时间") - private Date endTime; + private LocalDateTime endTime; @ExcelProperty("执行时长") private Integer duration; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java index 4e18e63dc..228ac3c86 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java @@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -27,7 +27,7 @@ public class ApiAccessLogExportReqVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始请求时间") - private Date[] beginTime; + private LocalDateTime[] beginTime; @ApiModelProperty(value = "执行时长", example = "100", notes = "大于等于,单位:毫秒") private Integer duration; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java index dc6618f08..62b4eeea8 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -32,7 +32,7 @@ public class ApiAccessLogPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "开始请求时间") - private Date[] beginTime; + private LocalDateTime[] beginTime; @ApiModelProperty(value = "执行时长", example = "100", notes = "大于等于,单位:毫秒") private Integer duration; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java index 0458affb0..2a6125d38 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - API 访问日志 Response VO") @Data @@ -18,6 +18,6 @@ public class ApiAccessLogRespVO extends ApiAccessLogBaseVO { private Long id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java index 08fbdace8..ad0b44368 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java @@ -5,7 +5,7 @@ import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; import javax.validation.constraints.NotNull; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -55,7 +55,7 @@ public class ApiErrorLogBaseVO { @ApiModelProperty(value = "异常发生时间", required = true) @NotNull(message = "异常发生时间不能为空") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private Date exceptionTime; + private LocalDateTime exceptionTime; @ApiModelProperty(value = "异常名", required = true) @NotNull(message = "异常名不能为空") diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java index 7e1e2ef0c..08f10894f 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; -import java.util.Date; +import java.time.LocalDateTime; /** * API 错误日志 Excel VO @@ -48,7 +48,7 @@ public class ApiErrorLogExcelVO { private String userAgent; @ExcelProperty("异常发生时间") - private Date exceptionTime; + private LocalDateTime exceptionTime; @ExcelProperty("异常名") private String exceptionName; @@ -75,14 +75,14 @@ public class ApiErrorLogExcelVO { private Integer exceptionLineNumber; @ExcelProperty("创建时间") - private Date createTime; + private LocalDateTime createTime; @ExcelProperty(value = "处理状态", converter = DictConvert.class) @DictFormat(DictTypeConstants.API_ERROR_LOG_PROCESS_STATUS) private Integer processStatus; @ExcelProperty("处理时间") - private Date processTime; + private LocalDateTime processTime; @ExcelProperty("处理用户编号") private Integer processUserId; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java index d8e121e0b..e2c241138 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java @@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -27,7 +27,7 @@ public class ApiErrorLogExportReqVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "异常发生时间") - private Date[] exceptionTime; + private LocalDateTime[] exceptionTime; @ApiModelProperty(value = "处理状态", example = "0") private Integer processStatus; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java index fda23ba14..56496325d 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; import org.springframework.format.annotation.DateTimeFormat; -import java.util.Date; +import java.time.LocalDateTime; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -32,7 +32,7 @@ public class ApiErrorLogPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "异常发生时间") - private Date[] exceptionTime; + private LocalDateTime[] exceptionTime; @ApiModelProperty(value = "处理状态", example = "0") private Integer processStatus; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java index 0f0c2724d..c108b548c 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java @@ -6,7 +6,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import java.util.Date; +import java.time.LocalDateTime; @ApiModel("管理后台 - API 错误日志 Response VO") @Data @@ -18,10 +18,10 @@ public class ApiErrorLogRespVO extends ApiErrorLogBaseVO { private Integer id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; @ApiModelProperty(value = "处理时间", required = true) - private Date processTime; + private LocalDateTime processTime; @ApiModelProperty(value = "处理用户编号", example = "233") private Integer processUserId; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExcelVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExcelVO.java index e87d89586..a135885fe 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExcelVO.java @@ -1,8 +1,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.test.vo; import lombok.*; -import java.util.*; -import io.swagger.annotations.*; + +import java.time.LocalDateTime; import com.alibaba.excel.annotation.ExcelProperty; @@ -33,6 +33,6 @@ public class TestDemoExcelVO { private String remark; @ExcelProperty("创建时间") - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java index a044a6de1..8c386d4c1 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoExportReqVO.java @@ -1,9 +1,9 @@ package cn.iocoder.yudao.module.infra.controller.admin.test.vo; import lombok.*; -import java.util.*; + +import java.time.LocalDateTime; import io.swagger.annotations.*; -import cn.iocoder.yudao.framework.common.pojo.PageParam; import org.springframework.format.annotation.DateTimeFormat; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @@ -29,6 +29,6 @@ public class TestDemoExportReqVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "创建时间") - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java index 2821a29bd..56b14c3d4 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoPageReqVO.java @@ -1,7 +1,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.test.vo; import lombok.*; -import java.util.*; + +import java.time.LocalDateTime; import io.swagger.annotations.*; import cn.iocoder.yudao.framework.common.pojo.PageParam; import org.springframework.format.annotation.DateTimeFormat; @@ -31,6 +32,6 @@ public class TestDemoPageReqVO extends PageParam { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @ApiModelProperty(value = "创建时间") - private Date[] createTime; + private LocalDateTime[] createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoRespVO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoRespVO.java index 56d6b0a11..4b38ee401 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoRespVO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/test/vo/TestDemoRespVO.java @@ -1,7 +1,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.test.vo; import lombok.*; -import java.util.*; + +import java.time.LocalDateTime; import io.swagger.annotations.*; @ApiModel("管理后台 - 字典类型 Response VO") @@ -14,6 +15,6 @@ public class TestDemoRespVO extends TestDemoBaseVO { private Long id; @ApiModelProperty(value = "创建时间", required = true) - private Date createTime; + private LocalDateTime createTime; } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobLogDO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobLogDO.java index 99fbd79ba..2d4cbafd4 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobLogDO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobLogDO.java @@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; -import java.util.Date; +import java.time.LocalDateTime; /** * 定时任务的执行日志 @@ -56,11 +56,11 @@ public class JobLogDO extends BaseDO { /** * 开始执行时间 */ - private Date beginTime; + private LocalDateTime beginTime; /** * 结束执行时间 */ - private Date endTime; + private LocalDateTime endTime; /** * 执行时长,单位:毫秒 */ diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java index 03a433f96..ab4292bf9 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java @@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; -import java.util.Date; +import java.time.LocalDateTime; /** * API 访问日志 @@ -84,11 +84,11 @@ public class ApiAccessLogDO extends BaseDO { /** * 开始请求时间 */ - private Date beginTime; + private LocalDateTime beginTime; /** * 结束请求时间 */ - private Date endTime; + private LocalDateTime endTime; /** * 执行时长,单位:毫秒 */ diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java index 524e8a2eb..7dc040981 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java @@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; -import java.util.Date; +import java.time.LocalDateTime; /** * API 异常数据 @@ -84,7 +84,7 @@ public class ApiErrorLogDO extends BaseDO { /** * 异常发生时间 */ - private Date exceptionTime; + private LocalDateTime exceptionTime; /** * 异常名 * @@ -145,7 +145,7 @@ public class ApiErrorLogDO extends BaseDO { /** * 处理时间 */ - private Date processTime; + private LocalDateTime processTime; /** * 处理用户编号 * diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigDAOImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigDAOImpl.java index 5ac88dcc3..eb32a9948 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigDAOImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigDAOImpl.java @@ -1,12 +1,13 @@ package cn.iocoder.yudao.module.infra.dal.mysql.config; +import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.apollo.internals.ConfigFrameworkDAO; import cn.iocoder.yudao.framework.apollo.internals.dto.ConfigRespDTO; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DriverManagerDataSource; import javax.sql.DataSource; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; /** @@ -24,7 +25,7 @@ public class ConfigDAOImpl implements ConfigFrameworkDAO { } @Override - public int selectCountByUpdateTimeGt(Date maxUpdateTime) { + public int selectCountByUpdateTimeGt(LocalDateTime maxUpdateTime) { return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM infra_config WHERE update_time > ?", Integer.class, maxUpdateTime); } @@ -34,7 +35,7 @@ public class ConfigDAOImpl implements ConfigFrameworkDAO { return jdbcTemplate.query("SELECT config_key, value, update_time, deleted FROM infra_config", (rs, rowNum) -> new ConfigRespDTO().setKey(rs.getString("config_key")) .setValue(rs.getString("value")) - .setUpdateTime(rs.getDate("update_time")) + .setUpdateTime(LocalDateTimeUtil.of(rs.getDate("update_time"))) .setDeleted(rs.getBoolean("deleted"))); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java index 69a1e1cd7..e770dcafd 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileConfigMapper.java @@ -8,7 +8,7 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileConfigDO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Select; -import java.util.Date; +import java.time.LocalDateTime; /** * 文件配置 Mapper @@ -27,6 +27,6 @@ public interface FileConfigMapper extends BaseMapperX { } @Select("SELECT COUNT(*) FROM infra_file_config WHERE update_time > #{maxUpdateTime}") - Long selectCountByUpdateTimeGt(Date maxUpdateTime); + Long selectCountByUpdateTimeGt(LocalDateTime maxUpdateTime); } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableServiceImpl.java index 9eb0a3a93..6b8346cf0 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/db/DatabaseTableServiceImpl.java @@ -53,7 +53,7 @@ public class DatabaseTableServiceImpl implements DatabaseTableService { if (StrUtil.isNotEmpty(name)) { strategyConfig.addInclude(name); } - GlobalConfig globalConfig = new GlobalConfig.Builder().dateType(DateType.ONLY_DATE).build(); // 只使用 Date 类型,不使用 LocalDate + GlobalConfig globalConfig = new GlobalConfig.Builder().dateType(DateType.TIME_PACK).build(); // 只使用 Date 类型,不使用 LocalDate ConfigBuilder builder = new ConfigBuilder(null, dataSourceConfig, strategyConfig.build(), null, globalConfig, null); // 按照名字排序 diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java index ea82c61b3..88a0ff59e 100755 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileConfigServiceImpl.java @@ -31,8 +31,8 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.PostConstruct; import javax.annotation.Resource; import javax.validation.Validator; +import java.time.LocalDateTime; import java.util.Collection; -import java.util.Date; import java.util.List; import java.util.Map; @@ -60,7 +60,7 @@ public class FileConfigServiceImpl implements FileConfigService { * 缓存菜单的最大更新时间,用于后续的增量轮询,判断是否有更新 */ @Getter - private volatile Date maxUpdateTime; + private volatile LocalDateTime maxUpdateTime; @Resource private FileClientFactory fileClientFactory; @@ -118,7 +118,7 @@ public class FileConfigServiceImpl implements FileConfigService { * @param maxUpdateTime 当前文件配置的最大更新时间 * @return 文件配置列表 */ - private List loadFileConfigIfUpdate(Date maxUpdateTime) { + private List loadFileConfigIfUpdate(LocalDateTime maxUpdateTime) { // 第一步,判断是否要更新。 if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据 log.info("[loadFileConfigIfUpdate][首次加载全量文件配置]"); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java index 8b3c2ef88..ff4777043 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java @@ -12,8 +12,8 @@ import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; +import java.time.LocalDateTime; import java.util.Collection; -import java.util.Date; import java.util.List; /** @@ -30,7 +30,7 @@ public class JobLogServiceImpl implements JobLogService { private JobLogMapper jobLogMapper; @Override - public Long createJobLog(Long jobId, Date beginTime, String jobHandlerName, String jobHandlerParam, Integer executeIndex) { + public Long createJobLog(Long jobId, LocalDateTime beginTime, String jobHandlerName, String jobHandlerParam, Integer executeIndex) { JobLogDO log = JobLogDO.builder().jobId(jobId).handlerName(jobHandlerName).handlerParam(jobHandlerParam).executeIndex(executeIndex) .beginTime(beginTime).status(JobLogStatusEnum.RUNNING.getStatus()).build(); jobLogMapper.insert(log); @@ -39,7 +39,7 @@ public class JobLogServiceImpl implements JobLogService { @Override @Async - public void updateJobLogResultAsync(Long logId, Date endTime, Integer duration, boolean success, String result) { + public void updateJobLogResultAsync(Long logId, LocalDateTime endTime, Integer duration, boolean success, String result) { try { JobLogDO updateObj = JobLogDO.builder().id(logId).endTime(endTime).duration(duration) .status(success ? JobLogStatusEnum.SUCCESS.getStatus() : JobLogStatusEnum.FAILURE.getStatus()).result(result).build(); diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java index d265f09f6..c1b129322 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java @@ -14,7 +14,7 @@ import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; -import java.util.Date; +import java.time.LocalDateTime; import java.util.List; /** @@ -57,7 +57,7 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService { } // 标记处理 apiErrorLogMapper.updateById(ApiErrorLogDO.builder().id(id).processStatus(processStatus) - .processUserId(processUserId).processTime(new Date()).build()); + .processUserId(processUserId).processTime(LocalDateTime.now()).build()); } } diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/_column.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/_column.vm index 2e2222509..69477d433 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/_column.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/_column.vm @@ -7,7 +7,7 @@ @NotNull(message = "${column.columnComment}不能为空") #end #end -#if (${column.javaType} == "Date")## 时间类型 +#if (${column.javaType} == "LocalDateTime")## 时间类型 @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) #end private ${column.javaType} ${column.javaField}; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/baseVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/baseVO.vm index 8b9fbaac2..a0ad48d60 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/baseVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/baseVO.vm @@ -5,7 +5,9 @@ import java.util.*; #foreach ($column in $columns) #if (${column.javaType} == "BigDecimal") import java.math.BigDecimal; -#break +#end +#if (${column.javaType} == "LocalDateTime") +import java.time.LocalDateTime; #end #end import io.swagger.annotations.*; @@ -13,7 +15,7 @@ import javax.validation.constraints.*; ## 处理 Date 字段的引入 #foreach ($column in $columns) #if (${column.createOperation} && ${column.updateOperation} && ${column.listOperationResult} - && ${column.javaType} == "Date")## 时间类型 + && ${column.javaType} == "LocalDateTime")## 时间类型 import org.springframework.format.annotation.DateTimeFormat; import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/createReqVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/createReqVO.vm index ca13efac5..dc6cee6b6 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/createReqVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/createReqVO.vm @@ -7,7 +7,7 @@ import javax.validation.constraints.*; ## 处理 Date 字段的引入 #foreach ($column in $columns) #if (${column.createOperation} && (!${column.updateOperation} || !${column.listOperationResult}) - && ${column.javaType} == "Date")## 时间类型 + && ${column.javaType} == "LocalDateTime")## 时间类型 import org.springframework.format.annotation.DateTimeFormat; import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/excelVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/excelVO.vm index 6b3ea2467..8bfd92b69 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/excelVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/excelVO.vm @@ -5,7 +5,9 @@ import java.util.*; #foreach ($column in $columns) #if (${column.javaType} == "BigDecimal") import java.math.BigDecimal; -#break +#end +#if (${column.javaType} == "LocalDateTime") +import java.time.LocalDateTime; #end #end import io.swagger.annotations.*; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/exportReqVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/exportReqVO.vm index afd583c28..cd68dd82e 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/exportReqVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/exportReqVO.vm @@ -6,7 +6,8 @@ import io.swagger.annotations.*; import ${PageParamClassName}; ## 处理 Date 字段的引入 #foreach ($column in $columns) -#if (${column.listOperation} && ${column.javaType} == "Date")## 时间类型 +#if (${column.listOperation} && ${column.javaType} == "LocalDateTime")## 时间类型 +import java.time.LocalDateTime; import org.springframework.format.annotation.DateTimeFormat; import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/pageReqVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/pageReqVO.vm index df2be7036..f2664390a 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/pageReqVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/pageReqVO.vm @@ -6,8 +6,9 @@ import io.swagger.annotations.*; import ${PageParamClassName}; ## 处理 Date 字段的引入 #foreach ($column in $columns) -#if (${column.listOperation} && ${column.javaType} == "Date")## 时间类型 +#if (${column.listOperation} && ${column.javaType} == "LocalDateTime")## 时间类型 import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; #break diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/updateReqVO.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/updateReqVO.vm index c6057d55a..636991508 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/updateReqVO.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/controller/vo/updateReqVO.vm @@ -7,9 +7,9 @@ import javax.validation.constraints.*; ## 处理 Date 字段的引入 #foreach ($column in $columns) #if (${column.updateOperation} && (!${column.createOperation} || !${column.listOperationResult}) - && ${column.javaType} == "Date")## 时间类型 + && ${column.javaType} == "LocalDateTime")## 时间类型 import org.springframework.format.annotation.DateTimeFormat; - +import java.time.LocalDateTime; import static ${DateUtilsClassName}.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; #break #end diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/do.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/do.vm index 4abae1591..d551d4b30 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/do.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/dal/do.vm @@ -5,7 +5,9 @@ import java.util.*; #foreach ($column in $columns) #if (${column.javaType} == "BigDecimal") import java.math.BigDecimal; -#break +#end +#if (${column.javaType} == "LocalDateTime") +import java.time.LocalDateTime; #end #end import com.baomidou.mybatisplus.annotation.*; diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm index 1b5c60a3f..e97fbb275 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/java/test/serviceTest.vm @@ -16,6 +16,7 @@ import ${PageResultClassName}; import javax.annotation.Resource; import org.springframework.context.annotation.Import; import java.util.*; +import java.time.LocalDateTime; import static cn.hutool.core.util.RandomUtil.*; import static ${basePackage}.module.${table.moduleName}.enums.ErrorCodeConstants.*; @@ -51,7 +52,7 @@ import static org.mockito.Mockito.*; #if (${column.listOperation}) #set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写 #if (${column.listOperationCondition} == "BETWEEN")## BETWEEN 的情况 - reqVO.set${JavaField}((new Date[]{})); + reqVO.set${JavaField}((new LocalDateTime[]{})); #else reqVO.set$JavaField(null); #end diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm index 3ea94190b..7a6add604 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/resources/codegen/vue/views/index.vue.vm @@ -65,7 +65,7 @@ #set ($javaField = $column.javaField) #set ($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set ($comment=$column.columnComment) -#if ($column.javaType == "Date")## 时间类型 +#if ($column.javaType == "LocalDateTime")## 时间类型