feat(新增): SecKill管理
This commit is contained in:
parent
757ed89c1a
commit
a80af36879
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀活动 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @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<IPage<Seckill>> 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<Seckill> pageParam = new Page<>();
|
||||||
|
IPage<Seckill> pageModel = secKillService.selectPage(pageParam, seckillQueryVo);
|
||||||
|
return Result.success(pageModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取")
|
||||||
|
@GetMapping("get/{id}")
|
||||||
|
public Result<Seckill> getSecKill(@PathVariable Long id) {
|
||||||
|
Seckill seckill = secKillService.getById(id);
|
||||||
|
return Result.success(seckill);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "新增")
|
||||||
|
@PostMapping("save")
|
||||||
|
public Result<Seckill> save(@RequestBody Seckill seckill) {
|
||||||
|
secKillService.save(seckill);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改")
|
||||||
|
@PutMapping("update")
|
||||||
|
public Result<Seckill> updateById(@RequestBody Seckill seckill) {
|
||||||
|
secKillService.updateById(seckill);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "删除")
|
||||||
|
@DeleteMapping("remove/{id}")
|
||||||
|
public Result<Seckill> removeById(@PathVariable Long id) {
|
||||||
|
secKillService.removeById(id);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "根据id列表删除")
|
||||||
|
@DeleteMapping("batchRemove")
|
||||||
|
public Result<Seckill> batchRemove(@RequestBody List<Long> ids) {
|
||||||
|
secKillService.removeByIds(ids);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "更新状态")
|
||||||
|
@PostMapping("updateStatus/{id}/{status}")
|
||||||
|
public Result<Seckill> updateStatus(@PathVariable Long id, @PathVariable Integer status) {
|
||||||
|
secKillService.updateStatus(id, status);
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.atguigu.ssyx.activity.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀活动商品关联 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/activity/seckill-sku")
|
||||||
|
public class SecKillSkuController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.atguigu.ssyx.activity.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀商品通知订阅 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/activity/seckill-sku-notice")
|
||||||
|
public class SecKillSkuNoticeController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.atguigu.ssyx.activity.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* sku信息 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/activity/sku-info")
|
||||||
|
public class SkuInfoController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atguigu.ssyx.activity.mapper;
|
||||||
|
|
||||||
|
import com.atguigu.ssyx.model.activity.Seckill;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀活动 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface SecKillMapper extends BaseMapper<Seckill> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atguigu.ssyx.activity.mapper;
|
||||||
|
|
||||||
|
import com.atguigu.ssyx.model.activity.SeckillSku;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀活动商品关联 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface SecKillSkuMapper extends BaseMapper<SeckillSku> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atguigu.ssyx.activity.mapper;
|
||||||
|
|
||||||
|
import com.atguigu.ssyx.model.activity.SeckillSkuNotice;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀商品通知订阅 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface SecKillSkuNoticeMapper extends BaseMapper<SeckillSkuNotice> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atguigu.ssyx.activity.mapper;
|
||||||
|
|
||||||
|
import com.atguigu.ssyx.model.product.SkuInfo;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* sku信息 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface SkuInfoMapper extends BaseMapper<SkuInfo> {
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀活动 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface SecKillService extends IService<Seckill> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 获取分页列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param seckillQueryVo 秒杀信息
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
|
IPage<Seckill> selectPage(Page<Seckill> pageParam, SeckillQueryVo seckillQueryVo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 更新状态
|
||||||
|
*
|
||||||
|
* @param id Id
|
||||||
|
* @param status 状态值
|
||||||
|
*/
|
||||||
|
void updateStatus(Long id, Integer status);
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atguigu.ssyx.activity.service;
|
||||||
|
|
||||||
|
import com.atguigu.ssyx.model.activity.SeckillSkuNotice;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀商品通知订阅 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface SecKillSkuNoticeService extends IService<SeckillSkuNotice> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atguigu.ssyx.activity.service;
|
||||||
|
|
||||||
|
import com.atguigu.ssyx.model.activity.SeckillSku;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀活动商品关联 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface SecKillSkuService extends IService<SeckillSku> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atguigu.ssyx.activity.service;
|
||||||
|
|
||||||
|
import com.atguigu.ssyx.model.product.SkuInfo;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* sku信息 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface SkuInfoService extends IService<SkuInfo> {
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀活动 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SeckillServiceImpl extends ServiceImpl<SecKillMapper, Seckill> implements SecKillService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 获取分页列表
|
||||||
|
*
|
||||||
|
* @param pageParam 分页参数
|
||||||
|
* @param seckillQueryVo 秒杀信息
|
||||||
|
* @return 分页结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IPage<Seckill> selectPage(Page<Seckill> pageParam, SeckillQueryVo seckillQueryVo) {
|
||||||
|
Integer status = seckillQueryVo.getStatus();
|
||||||
|
String title = seckillQueryVo.getTitle();
|
||||||
|
LambdaQueryWrapper<Seckill> 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);
|
||||||
|
}
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀商品通知订阅 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SeckillSkuNoticeServiceImpl extends ServiceImpl<SecKillSkuNoticeMapper, SeckillSkuNotice> implements SecKillSkuNoticeService {
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 秒杀活动商品关联 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SeckillSkuServiceImpl extends ServiceImpl<SecKillSkuMapper, SeckillSku> implements SecKillSkuService {
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* sku信息 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SkuInfoServiceImpl extends ServiceImpl<SkuInfoMapper, SkuInfo> implements SkuInfoService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.atguigu.ssyx.activity.mapper.SecKillMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.atguigu.ssyx.activity.mapper.SecKillSkuNoticeMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.atguigu.ssyx.activity.mapper.SeckillSkuMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.atguigu.ssyx.activity.mapper.SkuInfoMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.atguigu.ssyx.user.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 团长表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/user/leader")
|
||||||
|
public class LeaderController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.atguigu.ssyx.user.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 会员提货记录表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/user/user-delivery")
|
||||||
|
public class UserDeliveryController {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 团长表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 会员提货记录表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 团长表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface LeaderMapper extends BaseMapper<Leader> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atguigu.ssyx.user.mapper;
|
||||||
|
|
||||||
|
import com.atguigu.ssyx.user.entity.UserDelivery;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 会员提货记录表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface UserDeliveryMapper extends BaseMapper<UserDelivery> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atguigu.ssyx.user.mapper;
|
||||||
|
|
||||||
|
import com.atguigu.ssyx.model.user.User;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 会员表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface UserMapper extends BaseMapper<User> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.atguigu.ssyx.user.mapper.LeaderMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.atguigu.ssyx.user.mapper.UserDeliveryMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atguigu.ssyx.user.service;
|
||||||
|
|
||||||
|
import com.atguigu.ssyx.user.entity.Leader;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 团长表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface LeaderService extends IService<Leader> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.atguigu.ssyx.user.service;
|
||||||
|
|
||||||
|
import com.atguigu.ssyx.user.entity.UserDelivery;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 会员提货记录表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
public interface UserDeliveryService extends IService<UserDelivery> {
|
||||||
|
|
||||||
|
}
|
|
@ -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<User> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 先根据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);
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 团长表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class LeaderServiceImpl extends ServiceImpl<LeaderMapper, Leader> implements LeaderService {
|
||||||
|
|
||||||
|
}
|
|
@ -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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 会员提货记录表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author bunny
|
||||||
|
* @since 2024-04-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UserDeliveryServiceImpl extends ServiceImpl<UserDeliveryMapper, UserDelivery> implements UserDeliveryService {
|
||||||
|
|
||||||
|
}
|
|
@ -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<UserMapper, User> 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.<User>lambdaQuery().eq(User::getOpenId, openId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* * 根据用户Id查询默认团长Id
|
||||||
|
*
|
||||||
|
* @param userId 用户Id
|
||||||
|
* @return 团藏地址信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public LeaderAddressVo getLeaderAddressVoByUserId(Long userId) {
|
||||||
|
// 查询团长信息
|
||||||
|
LambdaQueryWrapper<UserDelivery> 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<Leader> 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<UserDelivery> 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.atguigu.ssyx.user.mapper.UserMapper">
|
||||||
|
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue