From 0786e2dede2d45c6eba4a3998fcade7746706eda Mon Sep 17 00:00:00 2001 From: topsun Date: Thu, 27 Apr 2023 23:43:44 +0800 Subject: [PATCH] =?UTF-8?q?service-driver-user=E6=B3=A8=E5=86=8C=E5=88=B0n?= =?UTF-8?q?acos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/internal/dto/DriverUser.java | 5 +++-- online-taxi-public/service-driver-user/pom.xml | 5 +++++ .../taxi/servicedriveruser/service/DriverUserService.java | 6 +++++- .../src/main/resources/application.yaml | 8 ++++---- .../service-driver-user/target/classes/application.yaml | 8 ++++---- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/online-taxi-public/internal-common/src/main/java/com/internal/dto/DriverUser.java b/online-taxi-public/internal-common/src/main/java/com/internal/dto/DriverUser.java index aea2379..f45e405 100644 --- a/online-taxi-public/internal-common/src/main/java/com/internal/dto/DriverUser.java +++ b/online-taxi-public/internal-common/src/main/java/com/internal/dto/DriverUser.java @@ -3,6 +3,7 @@ package com.internal.dto; import lombok.Data; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.Date; @Data @@ -64,7 +65,7 @@ public class DriverUser { private LocalDate contractOff; private Integer state; - private Date gmtCreate; - private Date gmtModified; + private LocalDateTime gmtCreate; + private LocalDateTime gmtModified; } diff --git a/online-taxi-public/service-driver-user/pom.xml b/online-taxi-public/service-driver-user/pom.xml index 914e4dd..9b2e217 100644 --- a/online-taxi-public/service-driver-user/pom.xml +++ b/online-taxi-public/service-driver-user/pom.xml @@ -27,6 +27,11 @@ mysql mysql-connector-java + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + \ No newline at end of file diff --git a/online-taxi-public/service-driver-user/src/main/java/com/taxi/servicedriveruser/service/DriverUserService.java b/online-taxi-public/service-driver-user/src/main/java/com/taxi/servicedriveruser/service/DriverUserService.java index 1ac402c..5392c41 100644 --- a/online-taxi-public/service-driver-user/src/main/java/com/taxi/servicedriveruser/service/DriverUserService.java +++ b/online-taxi-public/service-driver-user/src/main/java/com/taxi/servicedriveruser/service/DriverUserService.java @@ -6,6 +6,8 @@ import com.taxi.servicedriveruser.mapper.DriverUserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.time.LocalDateTime; + @Service public class DriverUserService { @@ -13,7 +15,9 @@ public class DriverUserService { private DriverUserMapper driverUserMapper; public ResponseResult addDriverUser(DriverUser driverUser){ - + LocalDateTime localDate = LocalDateTime.now(); + driverUser.setGmtCreate(localDate); + driverUser.setGmtModified(localDate); driverUserMapper.insert(driverUser); return ResponseResult.success(); } diff --git a/online-taxi-public/service-driver-user/src/main/resources/application.yaml b/online-taxi-public/service-driver-user/src/main/resources/application.yaml index 2f379ec..214a1b2 100644 --- a/online-taxi-public/service-driver-user/src/main/resources/application.yaml +++ b/online-taxi-public/service-driver-user/src/main/resources/application.yaml @@ -7,9 +7,9 @@ spring: url: jdbc:mysql://localhost:3306/service-driver-user?characterEncoding=utf-8&serverTimezone=GMT%2B8 username: root password: topsun123 -# cloud: -# nacos: -# discovery: -# server-addr: 127.0.0.1:8848 + cloud: + nacos: + discovery: + server-addr: 127.0.0.1:8848 application: name: service-driver-user \ No newline at end of file diff --git a/online-taxi-public/service-driver-user/target/classes/application.yaml b/online-taxi-public/service-driver-user/target/classes/application.yaml index 2f379ec..214a1b2 100644 --- a/online-taxi-public/service-driver-user/target/classes/application.yaml +++ b/online-taxi-public/service-driver-user/target/classes/application.yaml @@ -7,9 +7,9 @@ spring: url: jdbc:mysql://localhost:3306/service-driver-user?characterEncoding=utf-8&serverTimezone=GMT%2B8 username: root password: topsun123 -# cloud: -# nacos: -# discovery: -# server-addr: 127.0.0.1:8848 + cloud: + nacos: + discovery: + server-addr: 127.0.0.1:8848 application: name: service-driver-user \ No newline at end of file