From 2781689e778f6dc01d61ecc0b68e6fc43f677d04 Mon Sep 17 00:00:00 2001 From: JIAN Date: Mon, 2 Sep 2024 22:20:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(customer):=E6=96=B0=E5=A2=9E=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=9C=B0=E5=9D=80=E4=BF=A1=E6=81=AF=E7=9A=84=E5=86=85?= =?UTF-8?q?=E9=83=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jzo2o/api/customer/AddressBookApi.java | 19 +++++++++++ .../inner/InnerAddressBookController.java | 34 +++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 jzo2o-api/src/main/java/com/jzo2o/api/customer/AddressBookApi.java create mode 100644 jzo2o-customer/src/main/java/com/jzo2o/customer/controller/inner/InnerAddressBookController.java diff --git a/jzo2o-api/src/main/java/com/jzo2o/api/customer/AddressBookApi.java b/jzo2o-api/src/main/java/com/jzo2o/api/customer/AddressBookApi.java new file mode 100644 index 0000000..dd019a6 --- /dev/null +++ b/jzo2o-api/src/main/java/com/jzo2o/api/customer/AddressBookApi.java @@ -0,0 +1,19 @@ +package com.jzo2o.api.customer; + +import com.jzo2o.api.customer.dto.response.AddressBookResDTO; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +/** + * 内部接口 - 地址簿相关接口 + * @author JIAN + */ +@FeignClient(contextId = "jzo2o-customer", value = "jzo2o-customer", path = "/customer/inner/address-book") +public interface AddressBookApi { + /** + * 获取指定id对应的地址信息 + */ + @GetMapping("/{id}") + AddressBookResDTO getById(@PathVariable Long id); +} \ No newline at end of file diff --git a/jzo2o-customer/src/main/java/com/jzo2o/customer/controller/inner/InnerAddressBookController.java b/jzo2o-customer/src/main/java/com/jzo2o/customer/controller/inner/InnerAddressBookController.java new file mode 100644 index 0000000..322e366 --- /dev/null +++ b/jzo2o-customer/src/main/java/com/jzo2o/customer/controller/inner/InnerAddressBookController.java @@ -0,0 +1,34 @@ +package com.jzo2o.customer.controller.inner; + +import com.jzo2o.api.customer.AddressBookApi; +import com.jzo2o.api.customer.dto.response.AddressBookResDTO; +import com.jzo2o.common.utils.BeanUtils; +import com.jzo2o.customer.service.IAddressBookService; +import io.swagger.annotations.Api; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +/** + * 内部接口 - 地址簿相关接口 + * @author JIAN + */ +@RestController +@RequestMapping("/inner/address-book") +@Api(tags = "内部接口 - 地址簿相关接口") +public class InnerAddressBookController implements AddressBookApi { + @Resource + private IAddressBookService addressBookService; + + /** + * 获取指定id对应的地址信息 + */ + @Override + @GetMapping("/{id}") + public AddressBookResDTO getById(@PathVariable Long id) { + return BeanUtils.toBean(addressBookService.getById(id), AddressBookResDTO.class); + } +} \ No newline at end of file