diff --git a/spzx-service/service-order/src/main/java/com/atguigu/order/controller/OrderInfoController.java b/spzx-service/service-order/src/main/java/com/atguigu/order/controller/OrderInfoController.java new file mode 100644 index 0000000..7aecc68 --- /dev/null +++ b/spzx-service/service-order/src/main/java/com/atguigu/order/controller/OrderInfoController.java @@ -0,0 +1,26 @@ +package com.atguigu.order.controller; + +import com.atguigu.order.service.OrderInfoService; +import com.atguigu.spzx.model.vo.h5.TradeVo; +import com.atguigu.spzx.model.vo.result.Result; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@Tag(name = "订单管理") +@RestController +@RequestMapping(value = "/api/order/orderInfo") +public class OrderInfoController { + @Autowired + private OrderInfoService orderInfoService; + + @Operation(summary = "确认下单") + @GetMapping("auth/trade") + public Result trade() { + TradeVo tradeVo = orderInfoService.getTrade(); + return Result.success(tradeVo); + } +} \ No newline at end of file diff --git a/spzx-service/service-order/src/main/java/com/atguigu/order/mapper/OrderInfoMapper.java b/spzx-service/service-order/src/main/java/com/atguigu/order/mapper/OrderInfoMapper.java new file mode 100644 index 0000000..a6c84e2 --- /dev/null +++ b/spzx-service/service-order/src/main/java/com/atguigu/order/mapper/OrderInfoMapper.java @@ -0,0 +1,7 @@ +package com.atguigu.order.mapper; + +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface OrderInfoMapper { +} diff --git a/spzx-service/service-order/src/main/java/com/atguigu/order/service/OrderInfoService.java b/spzx-service/service-order/src/main/java/com/atguigu/order/service/OrderInfoService.java new file mode 100644 index 0000000..bd5c113 --- /dev/null +++ b/spzx-service/service-order/src/main/java/com/atguigu/order/service/OrderInfoService.java @@ -0,0 +1,4 @@ +package com.atguigu.order.service; + +public interface OrderInfoService { +} diff --git a/spzx-service/service-order/src/main/java/com/atguigu/order/service/impl/OrderInfoServiceImpl.java b/spzx-service/service-order/src/main/java/com/atguigu/order/service/impl/OrderInfoServiceImpl.java new file mode 100644 index 0000000..22eb219 --- /dev/null +++ b/spzx-service/service-order/src/main/java/com/atguigu/order/service/impl/OrderInfoServiceImpl.java @@ -0,0 +1,10 @@ +package com.atguigu.order.service.impl; + +import com.atguigu.order.service.OrderInfoService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; + +@Service +@Slf4j +public class OrderInfoServiceImpl implements OrderInfoService { +} diff --git a/spzx-service/service-order/src/main/resources/application-dev.yml b/spzx-service/service-order/src/main/resources/application-dev.yml index 5c51c8b..cd85024 100644 --- a/spzx-service/service-order/src/main/resources/application-dev.yml +++ b/spzx-service/service-order/src/main/resources/application-dev.yml @@ -4,4 +4,10 @@ bunny: port: 3305 sqlData: db_spzx username: root + password: "02120212" + + redis: + host: 47.120.65.66 + port: 6379 + database: 2 password: "02120212" \ No newline at end of file diff --git a/spzx-service/service-order/src/main/resources/application.yml b/spzx-service/service-order/src/main/resources/application.yml index 18c63b1..71bfd3f 100644 --- a/spzx-service/service-order/src/main/resources/application.yml +++ b/spzx-service/service-order/src/main/resources/application.yml @@ -22,6 +22,13 @@ spring: username: ${bunny.datasource.username} password: "${bunny.datasource.password}" + data: + redis: + host: ${bunny.redis.host} + port: ${bunny.redis.port} + database: ${bunny.redis.database} + password: ${bunny.redis.password} + logging: level: com.atguigu.spzx.order.mapper: debug diff --git a/spzx-service/service-order/src/main/resources/mapper/OrderInfoMapper.xml b/spzx-service/service-order/src/main/resources/mapper/OrderInfoMapper.xml new file mode 100644 index 0000000..09c19f0 --- /dev/null +++ b/spzx-service/service-order/src/main/resources/mapper/OrderInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/spzx-service/service-user/src/main/java/com/atguigu/user/controller/UserAddressController.java b/spzx-service/service-user/src/main/java/com/atguigu/user/controller/UserAddressController.java new file mode 100644 index 0000000..fbb6f09 --- /dev/null +++ b/spzx-service/service-user/src/main/java/com/atguigu/user/controller/UserAddressController.java @@ -0,0 +1,30 @@ +package com.atguigu.user.controller; + +import com.atguigu.spzx.model.entity.user.UserAddress; +import com.atguigu.spzx.model.vo.result.Result; +import com.atguigu.user.service.UserAddressService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Tag(name = "用户地址接口") +@RestController +@RequestMapping(value = "/api/user/userAddress") +@Slf4j +public class UserAddressController { + @Autowired + private UserAddressService userAddressService; + + @Operation(summary = "获取用户地址列表") + @GetMapping("auth/findUserAddressList") + public Result> findUserAddressList() { + List list = userAddressService.findUserAddressList(); + return Result.success(list); + } +} diff --git a/spzx-service/service-user/src/main/java/com/atguigu/user/mapper/UserAddressMapper.java b/spzx-service/service-user/src/main/java/com/atguigu/user/mapper/UserAddressMapper.java new file mode 100644 index 0000000..ca27f68 --- /dev/null +++ b/spzx-service/service-user/src/main/java/com/atguigu/user/mapper/UserAddressMapper.java @@ -0,0 +1,17 @@ +package com.atguigu.user.mapper; + +import com.atguigu.spzx.model.entity.user.UserAddress; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +@Mapper +public interface UserAddressMapper { + /** + * 查询用户地址栏 + * + * @param userId 用户id + * @return 地址列表 + */ + List selectByUserId(Long userId); +} diff --git a/spzx-service/service-user/src/main/java/com/atguigu/user/service/UserAddressService.java b/spzx-service/service-user/src/main/java/com/atguigu/user/service/UserAddressService.java new file mode 100644 index 0000000..9862689 --- /dev/null +++ b/spzx-service/service-user/src/main/java/com/atguigu/user/service/UserAddressService.java @@ -0,0 +1,14 @@ +package com.atguigu.user.service; + +import com.atguigu.spzx.model.entity.user.UserAddress; + +import java.util.List; + +public interface UserAddressService { + /** + * 获取用户地址列表 + * + * @return 用户地址列表 + */ + List findUserAddressList(); +} diff --git a/spzx-service/service-user/src/main/java/com/atguigu/user/service/impl/UserAddressServiceImpl.java b/spzx-service/service-user/src/main/java/com/atguigu/user/service/impl/UserAddressServiceImpl.java new file mode 100644 index 0000000..7243a69 --- /dev/null +++ b/spzx-service/service-user/src/main/java/com/atguigu/user/service/impl/UserAddressServiceImpl.java @@ -0,0 +1,35 @@ +package com.atguigu.user.service.impl; + +import com.atguigu.constant.MessageConstant; +import com.atguigu.context.BaseContext; +import com.atguigu.exception.BunnyException; +import com.atguigu.spzx.model.entity.user.UserAddress; +import com.atguigu.user.mapper.UserAddressMapper; +import com.atguigu.user.service.UserAddressService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +@Slf4j +public class UserAddressServiceImpl implements UserAddressService { + @Autowired + private UserAddressMapper userAddressMapper; + + /** + * 获取用户地址列表 + * + * @return 用户地址列表 + */ + @Override + public List findUserAddressList() { + // 查询用户地址栏 + Long userId = BaseContext.getUserInfo().getId(); + if (userId != null) { + return userAddressMapper.selectByUserId(userId); + } + throw new BunnyException(MessageConstant.FIND_ID_IS_NOT_EMPTY); + } +} diff --git a/spzx-service/service-user/src/main/resources/mapper/UserAddressMapper.xml b/spzx-service/service-user/src/main/resources/mapper/UserAddressMapper.xml new file mode 100644 index 0000000..86bc295 --- /dev/null +++ b/spzx-service/service-user/src/main/resources/mapper/UserAddressMapper.xml @@ -0,0 +1,11 @@ + + + + + + +