From 8feaf148eac7ebaa037989aac09e93392c3015a5 Mon Sep 17 00:00:00 2001 From: topsun Date: Thu, 27 Apr 2023 23:36:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=92=E5=85=A5=E5=8F=B8=E6=9C=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF-service-driver-user=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/internal/dto/DriverUser.java | 56 +++++++++++++++---- .../controller/DriverUserController.java | 10 ++++ .../service/DriverUserService.java | 7 +++ .../src/main/resources/application.yaml | 2 +- .../target/classes/application.yaml | 2 +- 5 files changed, 63 insertions(+), 14 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 50e94ab..aea2379 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 @@ -2,36 +2,68 @@ package com.internal.dto; import lombok.Data; +import java.time.LocalDate; import java.util.Date; @Data public class DriverUser { +/** - private Integer id; + { + "address":"地址", + "driverName":"司机姓名", + "driverPhone":"phone", + "driverGender":1, + "driverBrithday":"2020-01-02", + "driverNation":"01", + "driverContactAddress":"通信地址", + "licenseId":"机动车驾驶证号", + "getDriverLicenseDate":"2019-01-02", + "driverLicenseOn":"2019-01-02", + "driverLicenseOff":"2025-01-01", + "taxiDriver":1, + "certificateNo":"网络预约出租汽车驾驶员资格证号", + "networkCarIssueOrganization":"网络预约出租车驾驶员发证机构", + "networkCarIssueDate":"2020-01-02", + "getNetworkCarProofDate":"2020-01-02", + "networkCarProofOn":"2020-01-02", + "networkCarProofOff":"2025-01-02", + "registerDate":"2020-01-02", + "commercialType":1, + "contractCompany":"合约公司", + "contractOn":"2020-01-02", + "contractOff":"2020-01-02", + "state":1 + } + + **/ + + private Long id; private String address; private String driverName; private String driverPhone; private Integer driverGender; - private Date driverBrithday; + private LocalDate driverBrithday; private String driverNation; private String driverContactAddress; private String licenseId; - private Date getDriverLicenseDate; - private Date driverLicenseOn; - private Date driverLicenseOff; + private LocalDate getDriverLicenseDate; + private LocalDate driverLicenseOn; + private LocalDate driverLicenseOff; private Integer taxiDriver; private String certificateNo; private String networkCarIssueOrganization; - private Date networkCarIssueDate; - private Date getNetworkCarProofDate; - private Date networkCarProofOn; - private Date networkCarProofOff; - private Date registerDate; + private LocalDate networkCarIssueDate; + private LocalDate getNetworkCarProofDate; + private LocalDate networkCarProofOn; + private LocalDate networkCarProofOff; + private LocalDate registerDate; private Integer commercialType; private String contractCompany; - private Date contractOn; - private Date contractOff; + private LocalDate contractOn; + private LocalDate contractOff; private Integer state; + private Date gmtCreate; private Date gmtModified; diff --git a/online-taxi-public/service-driver-user/src/main/java/com/taxi/servicedriveruser/controller/DriverUserController.java b/online-taxi-public/service-driver-user/src/main/java/com/taxi/servicedriveruser/controller/DriverUserController.java index 66a7d85..fb631aa 100644 --- a/online-taxi-public/service-driver-user/src/main/java/com/taxi/servicedriveruser/controller/DriverUserController.java +++ b/online-taxi-public/service-driver-user/src/main/java/com/taxi/servicedriveruser/controller/DriverUserController.java @@ -1,14 +1,24 @@ package com.taxi.servicedriveruser.controller; +import com.internal.dto.DriverUser; +import com.internal.dto.ResponseResult; import com.taxi.servicedriveruser.service.DriverUserService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; + @RestController public class DriverUserController { @Autowired private DriverUserService driverUserService; + @PostMapping("/users") + public ResponseResult addDriverUser(@RequestBody DriverUser driverUser){ + + return driverUserService.addDriverUser(driverUser); + } } 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 07b4b94..1ac402c 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 @@ -1,5 +1,7 @@ package com.taxi.servicedriveruser.service; +import com.internal.dto.DriverUser; +import com.internal.dto.ResponseResult; import com.taxi.servicedriveruser.mapper.DriverUserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -10,5 +12,10 @@ public class DriverUserService { @Autowired private DriverUserMapper driverUserMapper; + public ResponseResult addDriverUser(DriverUser driverUser){ + + 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 7323e76..2f379ec 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 @@ -4,7 +4,7 @@ server: spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/service-price?characterEncoding=utf-8&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/service-driver-user?characterEncoding=utf-8&serverTimezone=GMT%2B8 username: root password: topsun123 # cloud: 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 7323e76..2f379ec 100644 --- a/online-taxi-public/service-driver-user/target/classes/application.yaml +++ b/online-taxi-public/service-driver-user/target/classes/application.yaml @@ -4,7 +4,7 @@ server: spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/service-price?characterEncoding=utf-8&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/service-driver-user?characterEncoding=utf-8&serverTimezone=GMT%2B8 username: root password: topsun123 # cloud: