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