From a80af36879b905344f12a295f876f5d54edf4a7b Mon Sep 17 00:00:00 2001 From: bunny <1319900154@qq.com> Date: Sat, 6 Apr 2024 17:32:35 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=96=B0=E5=A2=9E):=20SecKill=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SecKillController.java | 89 ++++++++++ .../controller/SecKillSkuController.java | 20 +++ .../SecKillSkuNoticeController.java | 20 +++ .../controller/SkuInfoController.java | 21 +++ .../ssyx/activity/mapper/SecKillMapper.java | 16 ++ .../activity/mapper/SecKillSkuMapper.java | 16 ++ .../mapper/SecKillSkuNoticeMapper.java | 16 ++ .../ssyx/activity/mapper/SkuInfoMapper.java | 16 ++ .../ssyx/activity/service/SecKillService.java | 35 ++++ .../service/SecKillSkuNoticeService.java | 16 ++ .../activity/service/SecKillSkuService.java | 16 ++ .../ssyx/activity/service/SkuInfoService.java | 16 ++ .../service/impl/SeckillServiceImpl.java | 59 +++++++ .../impl/SeckillSkuNoticeServiceImpl.java | 20 +++ .../service/impl/SeckillSkuServiceImpl.java | 20 +++ .../service/impl/SkuInfoServiceImpl.java | 20 +++ .../main/resources/mapper/SecKillMapper.xml | 5 + .../mapper/SecKillSkuNoticeMapper.xml | 5 + .../resources/mapper/SeckillSkuMapper.xml | 5 + .../main/resources/mapper/SkuInfoMapper.xml | 5 + .../user/controller/LeaderController.java | 21 +++ .../ssyx/user/controller/UserController.java | 12 ++ .../controller/UserDeliveryController.java | 21 +++ .../com/atguigu/ssyx/user/entity/Leader.java | 162 ++++++++++++++++++ .../ssyx/user/entity/UserDelivery.java | 66 +++++++ .../ssyx/user/mapper/LeaderMapper.java | 18 ++ .../ssyx/user/mapper/UserDeliveryMapper.java | 16 ++ .../atguigu/ssyx/user/mapper/UserMapper.java | 16 ++ .../ssyx/user/mapper/xml/LeaderMapper.xml | 5 + .../user/mapper/xml/UserDeliveryMapper.xml | 5 + .../ssyx/user/service/LeaderService.java | 16 ++ .../user/service/UserDeliveryService.java | 16 ++ .../ssyx/user/service/UserService.java | 33 ++++ .../user/service/impl/LeaderServiceImpl.java | 20 +++ .../service/impl/UserDeliveryServiceImpl.java | 20 +++ .../user/service/impl/UserServiceImpl.java | 109 ++++++++++++ .../src/main/resources/mapper/UserMapper.xml | 5 + 37 files changed, 997 insertions(+) create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillController.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillSkuController.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillSkuNoticeController.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SkuInfoController.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillMapper.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillSkuMapper.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillSkuNoticeMapper.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SkuInfoMapper.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillService.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillSkuNoticeService.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillSkuService.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SkuInfoService.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillServiceImpl.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillSkuNoticeServiceImpl.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillSkuServiceImpl.java create mode 100644 service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SkuInfoServiceImpl.java create mode 100644 service/service-activity/src/main/resources/mapper/SecKillMapper.xml create mode 100644 service/service-activity/src/main/resources/mapper/SecKillSkuNoticeMapper.xml create mode 100644 service/service-activity/src/main/resources/mapper/SeckillSkuMapper.xml create mode 100644 service/service-activity/src/main/resources/mapper/SkuInfoMapper.xml create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/controller/LeaderController.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/controller/UserController.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/controller/UserDeliveryController.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/entity/Leader.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/entity/UserDelivery.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/LeaderMapper.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/UserDeliveryMapper.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/UserMapper.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/xml/LeaderMapper.xml create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/xml/UserDeliveryMapper.xml create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/service/LeaderService.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/service/UserDeliveryService.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/service/UserService.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/LeaderServiceImpl.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/UserDeliveryServiceImpl.java create mode 100644 service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/UserServiceImpl.java create mode 100644 service/service-user/src/main/resources/mapper/UserMapper.xml diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillController.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillController.java new file mode 100644 index 0000000..6fb1ef5 --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillController.java @@ -0,0 +1,89 @@ +package com.atguigu.ssyx.activity.controller; + + +import com.atguigu.ssyx.activity.service.SecKillService; +import com.atguigu.ssyx.common.result.Result; +import com.atguigu.ssyx.model.activity.Seckill; +import com.atguigu.ssyx.vo.activity.SeckillQueryVo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + *

+ * 秒杀活动 前端控制器 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@Api(value = "Seckill管理", tags = "Seckill管理") +@RestController +@RequestMapping(value = "/admin/activity/seckill") +public class SecKillController { + @Autowired + private SecKillService secKillService; + + @ApiOperation(value = "获取分页列表") + @GetMapping("{page}/{limit}") + public Result> index( + @ApiParam(name = "page", value = "当前页码", required = true) + @PathVariable Long page, + @ApiParam(name = "limit", value = "每页记录数", required = true) + @PathVariable Long limit, + @ApiParam(name = "seckillQueryVo", value = "查询对象", required = false) + SeckillQueryVo seckillQueryVo) { + Page pageParam = new Page<>(); + IPage pageModel = secKillService.selectPage(pageParam, seckillQueryVo); + return Result.success(pageModel); + } + + @ApiOperation(value = "获取") + @GetMapping("get/{id}") + public Result getSecKill(@PathVariable Long id) { + Seckill seckill = secKillService.getById(id); + return Result.success(seckill); + } + + @ApiOperation(value = "新增") + @PostMapping("save") + public Result save(@RequestBody Seckill seckill) { + secKillService.save(seckill); + return Result.success(); + } + + @ApiOperation(value = "修改") + @PutMapping("update") + public Result updateById(@RequestBody Seckill seckill) { + secKillService.updateById(seckill); + return Result.success(); + } + + @ApiOperation(value = "删除") + @DeleteMapping("remove/{id}") + public Result removeById(@PathVariable Long id) { + secKillService.removeById(id); + return Result.success(); + } + + @ApiOperation(value = "根据id列表删除") + @DeleteMapping("batchRemove") + public Result batchRemove(@RequestBody List ids) { + secKillService.removeByIds(ids); + return Result.success(); + } + + @ApiOperation(value = "更新状态") + @PostMapping("updateStatus/{id}/{status}") + public Result updateStatus(@PathVariable Long id, @PathVariable Integer status) { + secKillService.updateStatus(id, status); + return Result.success(); + } +} + diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillSkuController.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillSkuController.java new file mode 100644 index 0000000..193b97a --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillSkuController.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.activity.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 秒杀活动商品关联 前端控制器 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@RestController +@RequestMapping("/activity/seckill-sku") +public class SecKillSkuController { + +} + diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillSkuNoticeController.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillSkuNoticeController.java new file mode 100644 index 0000000..ee50a0a --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SecKillSkuNoticeController.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.activity.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 秒杀商品通知订阅 前端控制器 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@RestController +@RequestMapping("/activity/seckill-sku-notice") +public class SecKillSkuNoticeController { + +} + diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SkuInfoController.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SkuInfoController.java new file mode 100644 index 0000000..eea1e19 --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/controller/SkuInfoController.java @@ -0,0 +1,21 @@ +package com.atguigu.ssyx.activity.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * sku信息 前端控制器 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@RestController +@RequestMapping("/activity/sku-info") +public class SkuInfoController { + +} + diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillMapper.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillMapper.java new file mode 100644 index 0000000..ac9b932 --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.activity.mapper; + +import com.atguigu.ssyx.model.activity.Seckill; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 秒杀活动 Mapper 接口 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface SecKillMapper extends BaseMapper { + +} diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillSkuMapper.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillSkuMapper.java new file mode 100644 index 0000000..d6d2225 --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillSkuMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.activity.mapper; + +import com.atguigu.ssyx.model.activity.SeckillSku; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 秒杀活动商品关联 Mapper 接口 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface SecKillSkuMapper extends BaseMapper { + +} diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillSkuNoticeMapper.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillSkuNoticeMapper.java new file mode 100644 index 0000000..968a713 --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SecKillSkuNoticeMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.activity.mapper; + +import com.atguigu.ssyx.model.activity.SeckillSkuNotice; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 秒杀商品通知订阅 Mapper 接口 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface SecKillSkuNoticeMapper extends BaseMapper { + +} diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SkuInfoMapper.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SkuInfoMapper.java new file mode 100644 index 0000000..6d80c3b --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/mapper/SkuInfoMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.activity.mapper; + +import com.atguigu.ssyx.model.product.SkuInfo; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * sku信息 Mapper 接口 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface SkuInfoMapper extends BaseMapper { + +} diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillService.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillService.java new file mode 100644 index 0000000..439ac9d --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillService.java @@ -0,0 +1,35 @@ +package com.atguigu.ssyx.activity.service; + +import com.atguigu.ssyx.model.activity.Seckill; +import com.atguigu.ssyx.vo.activity.SeckillQueryVo; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 秒杀活动 服务类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface SecKillService extends IService { + + /** + * * 获取分页列表 + * + * @param pageParam 分页参数 + * @param seckillQueryVo 秒杀信息 + * @return 分页结果 + */ + IPage selectPage(Page pageParam, SeckillQueryVo seckillQueryVo); + + /** + * * 更新状态 + * + * @param id Id + * @param status 状态值 + */ + void updateStatus(Long id, Integer status); +} diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillSkuNoticeService.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillSkuNoticeService.java new file mode 100644 index 0000000..9895825 --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillSkuNoticeService.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.activity.service; + +import com.atguigu.ssyx.model.activity.SeckillSkuNotice; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 秒杀商品通知订阅 服务类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface SecKillSkuNoticeService extends IService { + +} diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillSkuService.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillSkuService.java new file mode 100644 index 0000000..2c1c8d2 --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SecKillSkuService.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.activity.service; + +import com.atguigu.ssyx.model.activity.SeckillSku; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 秒杀活动商品关联 服务类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface SecKillSkuService extends IService { + +} diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SkuInfoService.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SkuInfoService.java new file mode 100644 index 0000000..99cf905 --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/SkuInfoService.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.activity.service; + +import com.atguigu.ssyx.model.product.SkuInfo; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * sku信息 服务类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface SkuInfoService extends IService { + +} diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillServiceImpl.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillServiceImpl.java new file mode 100644 index 0000000..fb9b9d7 --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillServiceImpl.java @@ -0,0 +1,59 @@ +package com.atguigu.ssyx.activity.service.impl; + +import com.atguigu.ssyx.activity.mapper.SecKillMapper; +import com.atguigu.ssyx.activity.service.SecKillService; +import com.atguigu.ssyx.model.activity.Seckill; +import com.atguigu.ssyx.vo.activity.SeckillQueryVo; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; + +/** + *

+ * 秒杀活动 服务实现类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@Service +public class SeckillServiceImpl extends ServiceImpl implements SecKillService { + + /** + * * 获取分页列表 + * + * @param pageParam 分页参数 + * @param seckillQueryVo 秒杀信息 + * @return 分页结果 + */ + @Override + public IPage selectPage(Page pageParam, SeckillQueryVo seckillQueryVo) { + Integer status = seckillQueryVo.getStatus(); + String title = seckillQueryVo.getTitle(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + if (!StringUtils.isEmpty(status)) { + wrapper.eq(Seckill::getStatus, status); + } + if (!StringUtils.isEmpty(title)) { + wrapper.like(Seckill::getTitle, title); + } + return baseMapper.selectPage(pageParam, wrapper); + } + + /** + * * 更新状态 + * + * @param id Id + * @param status 状态值 + */ + @Override + public void updateStatus(Long id, Integer status) { + Seckill seckill = new Seckill(); + seckill.setStatus(status); + seckill.setId(id); + this.updateById(seckill); + } +} diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillSkuNoticeServiceImpl.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillSkuNoticeServiceImpl.java new file mode 100644 index 0000000..1fa5132 --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillSkuNoticeServiceImpl.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.activity.service.impl; + +import com.atguigu.ssyx.activity.mapper.SecKillSkuNoticeMapper; +import com.atguigu.ssyx.activity.service.SecKillSkuNoticeService; +import com.atguigu.ssyx.model.activity.SeckillSkuNotice; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 秒杀商品通知订阅 服务实现类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@Service +public class SeckillSkuNoticeServiceImpl extends ServiceImpl implements SecKillSkuNoticeService { + +} diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillSkuServiceImpl.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillSkuServiceImpl.java new file mode 100644 index 0000000..c212c7d --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SeckillSkuServiceImpl.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.activity.service.impl; + +import com.atguigu.ssyx.activity.mapper.SecKillSkuMapper; +import com.atguigu.ssyx.activity.service.SecKillSkuService; +import com.atguigu.ssyx.model.activity.SeckillSku; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 秒杀活动商品关联 服务实现类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@Service +public class SeckillSkuServiceImpl extends ServiceImpl implements SecKillSkuService { + +} diff --git a/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SkuInfoServiceImpl.java b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SkuInfoServiceImpl.java new file mode 100644 index 0000000..9e120d1 --- /dev/null +++ b/service/service-activity/src/main/java/com/atguigu/ssyx/activity/service/impl/SkuInfoServiceImpl.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.activity.service.impl; + +import com.atguigu.ssyx.activity.mapper.SkuInfoMapper; +import com.atguigu.ssyx.activity.service.SkuInfoService; +import com.atguigu.ssyx.model.product.SkuInfo; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * sku信息 服务实现类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@Service +public class SkuInfoServiceImpl extends ServiceImpl implements SkuInfoService { + +} diff --git a/service/service-activity/src/main/resources/mapper/SecKillMapper.xml b/service/service-activity/src/main/resources/mapper/SecKillMapper.xml new file mode 100644 index 0000000..abce83b --- /dev/null +++ b/service/service-activity/src/main/resources/mapper/SecKillMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/service/service-activity/src/main/resources/mapper/SecKillSkuNoticeMapper.xml b/service/service-activity/src/main/resources/mapper/SecKillSkuNoticeMapper.xml new file mode 100644 index 0000000..5665bbb --- /dev/null +++ b/service/service-activity/src/main/resources/mapper/SecKillSkuNoticeMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/service/service-activity/src/main/resources/mapper/SeckillSkuMapper.xml b/service/service-activity/src/main/resources/mapper/SeckillSkuMapper.xml new file mode 100644 index 0000000..c6d7021 --- /dev/null +++ b/service/service-activity/src/main/resources/mapper/SeckillSkuMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/service/service-activity/src/main/resources/mapper/SkuInfoMapper.xml b/service/service-activity/src/main/resources/mapper/SkuInfoMapper.xml new file mode 100644 index 0000000..3a60c1a --- /dev/null +++ b/service/service-activity/src/main/resources/mapper/SkuInfoMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/controller/LeaderController.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/controller/LeaderController.java new file mode 100644 index 0000000..b9d0fe9 --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/controller/LeaderController.java @@ -0,0 +1,21 @@ +package com.atguigu.ssyx.user.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 团长表 前端控制器 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@RestController +@RequestMapping("/user/leader") +public class LeaderController { + +} + diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/controller/UserController.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/controller/UserController.java new file mode 100644 index 0000000..38c6162 --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/controller/UserController.java @@ -0,0 +1,12 @@ +package com.atguigu.ssyx.user.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/user/user") +public class UserController { + +} + diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/controller/UserDeliveryController.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/controller/UserDeliveryController.java new file mode 100644 index 0000000..be1f5fd --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/controller/UserDeliveryController.java @@ -0,0 +1,21 @@ +package com.atguigu.ssyx.user.controller; + + +import org.springframework.web.bind.annotation.RequestMapping; + +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 会员提货记录表 前端控制器 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@RestController +@RequestMapping("/user/user-delivery") +public class UserDeliveryController { + +} + diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/entity/Leader.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/entity/Leader.java new file mode 100644 index 0000000..2aa0eec --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/entity/Leader.java @@ -0,0 +1,162 @@ +package com.atguigu.ssyx.user.entity; + +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 团长表 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class Leader implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 用户id + */ + private Long userId; + + /** + * 区域id + */ + private Long regionId; + + /** + * 名称 + */ + private String name; + + /** + * 手机号码 + */ + private String phone; + + /** + * 身份证 + */ + private String idNo; + + /** + * 身份证图片路径 + */ + private String idNoUrl1; + + /** + * 身份证图片路径 + */ + private String idNoUrl2; + + /** + * 提货点名称 + */ + private String takeName; + + /** + * 提货点类型;1->宝妈;2->便利店店主;3->快递站点;4->物业中心 + */ + private String takeType; + + /** + * 省 + */ + private Long province; + + /** + * 城市 + */ + private Long city; + + /** + * 区域code + */ + private Long district; + + /** + * 详细地址 + */ + private String detailAddress; + + /** + * 经度 + */ + private BigDecimal longitude; + + /** + * 纬度 + */ + private BigDecimal latitude; + + /** + * 有无门店 + */ + private String haveStore; + + /** + * 门店照片 + */ + private String storePath; + + /** + * 营业时间 + */ + private String workTime; + + /** + * 营业状态 + */ + private Integer workStatus; + + /** + * 审核状态(0:提交审核 1:审核通过 -1:审核未通过) + */ + private Integer checkStatus; + + /** + * 审核时间 + */ + private LocalDateTime checkTime; + + /** + * 审核用户 + */ + private String checkUser; + + /** + * 审核内容 + */ + private String checkContent; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 更新时间 + */ + private LocalDateTime updateTime; + + /** + * 删除标记(0:不可用 1:可用) + */ + private Integer isDeleted; + + +} diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/entity/UserDelivery.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/entity/UserDelivery.java new file mode 100644 index 0000000..76d1823 --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/entity/UserDelivery.java @@ -0,0 +1,66 @@ +package com.atguigu.ssyx.user.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import java.time.LocalDateTime; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + *

+ * 会员提货记录表 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class UserDelivery implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + @TableId(value = "id", type = IdType.AUTO) + private Long id; + + /** + * 会员ID + */ + private String userId; + + /** + * 团长id + */ + private Long leaderId; + + /** + * 仓库id + */ + private Long wareId; + + /** + * 是否默认 + */ + private String isDefault; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 更新时间 + */ + private LocalDateTime updateTime; + + /** + * 删除标记(0:不可用 1:可用) + */ + private Integer isDeleted; + + +} diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/LeaderMapper.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/LeaderMapper.java new file mode 100644 index 0000000..27e2d06 --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/LeaderMapper.java @@ -0,0 +1,18 @@ +package com.atguigu.ssyx.user.mapper; + +import com.atguigu.ssyx.user.entity.Leader; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.springframework.stereotype.Repository; + +/** + *

+ * 团长表 Mapper 接口 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@Repository +public interface LeaderMapper extends BaseMapper { + +} diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/UserDeliveryMapper.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/UserDeliveryMapper.java new file mode 100644 index 0000000..95b08bd --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/UserDeliveryMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.user.mapper; + +import com.atguigu.ssyx.user.entity.UserDelivery; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 会员提货记录表 Mapper 接口 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface UserDeliveryMapper extends BaseMapper { + +} diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/UserMapper.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/UserMapper.java new file mode 100644 index 0000000..c852566 --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/UserMapper.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.user.mapper; + +import com.atguigu.ssyx.model.user.User; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 会员表 Mapper 接口 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface UserMapper extends BaseMapper { + +} diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/xml/LeaderMapper.xml b/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/xml/LeaderMapper.xml new file mode 100644 index 0000000..5e2a8cf --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/xml/LeaderMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/xml/UserDeliveryMapper.xml b/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/xml/UserDeliveryMapper.xml new file mode 100644 index 0000000..c0dab11 --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/mapper/xml/UserDeliveryMapper.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/service/LeaderService.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/LeaderService.java new file mode 100644 index 0000000..053ad8f --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/LeaderService.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.user.service; + +import com.atguigu.ssyx.user.entity.Leader; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 团长表 服务类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface LeaderService extends IService { + +} diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/service/UserDeliveryService.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/UserDeliveryService.java new file mode 100644 index 0000000..d71dd79 --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/UserDeliveryService.java @@ -0,0 +1,16 @@ +package com.atguigu.ssyx.user.service; + +import com.atguigu.ssyx.user.entity.UserDelivery; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 会员提货记录表 服务类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +public interface UserDeliveryService extends IService { + +} diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/service/UserService.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/UserService.java new file mode 100644 index 0000000..96ed22d --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/UserService.java @@ -0,0 +1,33 @@ +package com.atguigu.ssyx.user.service; + +import com.atguigu.ssyx.model.user.User; +import com.atguigu.ssyx.vo.user.LeaderAddressVo; +import com.atguigu.ssyx.vo.user.UserLoginVo; +import com.baomidou.mybatisplus.extension.service.IService; + +public interface UserService extends IService { + + /** + * 先根据openid进行数据库查询 + * + * @param openId openId + * @return User + */ + User getUserByOpenId(String openId); + + /** + * * 根据用户Id查询默认团长Id + * + * @param id 用户Id + * @return 团藏地址信息 + */ + LeaderAddressVo getLeaderAddressVoByUserId(Long id); + + /** + * * 获取当前用户登录信息 + * + * @param userId 用户Id + * @return UserLoginVo + */ + UserLoginVo getUserLoginVo(Long userId); +} diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/LeaderServiceImpl.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/LeaderServiceImpl.java new file mode 100644 index 0000000..aca3027 --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/LeaderServiceImpl.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.user.service.impl; + +import com.atguigu.ssyx.user.entity.Leader; +import com.atguigu.ssyx.user.mapper.LeaderMapper; +import com.atguigu.ssyx.user.service.LeaderService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 团长表 服务实现类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@Service +public class LeaderServiceImpl extends ServiceImpl implements LeaderService { + +} diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/UserDeliveryServiceImpl.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/UserDeliveryServiceImpl.java new file mode 100644 index 0000000..ddb6beb --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/UserDeliveryServiceImpl.java @@ -0,0 +1,20 @@ +package com.atguigu.ssyx.user.service.impl; + +import com.atguigu.ssyx.user.entity.UserDelivery; +import com.atguigu.ssyx.user.mapper.UserDeliveryMapper; +import com.atguigu.ssyx.user.service.UserDeliveryService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 会员提货记录表 服务实现类 + *

+ * + * @author bunny + * @since 2024-04-06 + */ +@Service +public class UserDeliveryServiceImpl extends ServiceImpl implements UserDeliveryService { + +} diff --git a/service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/UserServiceImpl.java b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..1c0fa47 --- /dev/null +++ b/service/service-user/src/main/java/com/atguigu/ssyx/user/service/impl/UserServiceImpl.java @@ -0,0 +1,109 @@ +package com.atguigu.ssyx.user.service.impl; + +import com.atguigu.ssyx.enums.UserType; +import com.atguigu.ssyx.model.user.User; +import com.atguigu.ssyx.user.entity.Leader; +import com.atguigu.ssyx.user.entity.UserDelivery; +import com.atguigu.ssyx.user.mapper.UserMapper; +import com.atguigu.ssyx.user.service.LeaderService; +import com.atguigu.ssyx.user.service.UserDeliveryService; +import com.atguigu.ssyx.user.service.UserService; +import com.atguigu.ssyx.vo.user.LeaderAddressVo; +import com.atguigu.ssyx.vo.user.UserLoginVo; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class UserServiceImpl extends ServiceImpl implements UserService { + @Autowired + private UserDeliveryService userDeliveryService; + @Autowired + private LeaderService leaderService; + + /** + * 先根据openid进行数据库查询 + * + * @param openId openId + * @return User + */ + @Override + public User getUserByOpenId(String openId) { + return getOne(Wrappers.lambdaQuery().eq(User::getOpenId, openId)); + } + + /** + * * 根据用户Id查询默认团长Id + * + * @param userId 用户Id + * @return 团藏地址信息 + */ + @Override + public LeaderAddressVo getLeaderAddressVoByUserId(Long userId) { + // 查询团长信息 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(userId != null, UserDelivery::getUserId, userId); + wrapper.eq(UserDelivery::getIsDefault, 1); + UserDelivery userDelivery = userDeliveryService.getOne(wrapper); + if (userDelivery == null) return null; + // 查询团长Id及其其它信息 + Leader leader = leaderService.getById(userDelivery.getLeaderId()); + + LeaderAddressVo leaderAddressVo = new LeaderAddressVo(); + BeanUtils.copyProperties(leader, leaderAddressVo); + leaderAddressVo.setUserId(userId); + leaderAddressVo.setLeaderId(leader.getId()); + leaderAddressVo.setLeaderName(leader.getName()); + leaderAddressVo.setLeaderPhone(leader.getPhone()); + leaderAddressVo.setWareId(userDelivery.getWareId()); + leaderAddressVo.setStorePath(leader.getStorePath()); + return leaderAddressVo; + } + + /** + * * 获取当前用户登录信息 + * + * @param userId 用户Id + * @return UserLoginVo + */ + @Override + public UserLoginVo getUserLoginVo(Long userId) { + UserLoginVo userLoginVo = new UserLoginVo(); + User user = this.getById(userId); + userLoginVo.setNickName(user.getNickName()); + userLoginVo.setUserId(userId); + userLoginVo.setPhotoUrl(user.getPhotoUrl()); + userLoginVo.setOpenId(user.getOpenId()); + userLoginVo.setIsNew(user.getIsNew()); + + // 如果是团长获取当前前团长id与对应的仓库id + if (user.getUserType() == UserType.LEADER) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(Leader::getUserId, userId); + queryWrapper.eq(Leader::getCheckStatus, 1); + Leader leader = leaderService.getOne(queryWrapper); + if (null != leader) { + userLoginVo.setLeaderId(leader.getId()); + Long wareId = regionFeignClient.getWareId(leader.getRegionId()); + userLoginVo.setWareId(wareId); + } + } else { + // 如果是会员获取当前会员对应的仓库id + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(UserDelivery::getUserId, userId); + queryWrapper.eq(UserDelivery::getIsDefault, 1); + UserDelivery userDelivery = userDeliveryService.getOne(queryWrapper); + if (null != userDelivery) { + userLoginVo.setLeaderId(userDelivery.getLeaderId()); + userLoginVo.setWareId(userDelivery.getWareId()); + } else { + userLoginVo.setLeaderId(1L); + userLoginVo.setWareId(1L); + } + } + return userLoginVo; + } +} diff --git a/service/service-user/src/main/resources/mapper/UserMapper.xml b/service/service-user/src/main/resources/mapper/UserMapper.xml new file mode 100644 index 0000000..2e4078d --- /dev/null +++ b/service/service-user/src/main/resources/mapper/UserMapper.xml @@ -0,0 +1,5 @@ + + + + +