Merge remote-tracking branch 'origin/master' into feature/vue3
commit
042c4e8390
@ -1,29 +0,0 @@
|
||||
package cn.iocoder.yudao.module.CouponTemplete.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券 - 是否开启过期提醒
|
||||
*
|
||||
* @author Sin
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum CouponExpireTimeTypeEnum {
|
||||
|
||||
OPEN(1,"不开启"),
|
||||
CLOSE(0,"开启"),;
|
||||
|
||||
/**
|
||||
* 是否开启过期提醒
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 是否开启过期提醒
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package cn.iocoder.yudao.module.CouponTemplete.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券 - 领取是否无限制 0
|
||||
*
|
||||
* @author Sin
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum CouponFetchTypeEnum {
|
||||
|
||||
LIMIT(1,"限制"),
|
||||
NOT_LIMIT(0,"不限制"),;
|
||||
|
||||
/**
|
||||
* 是否开启过期提醒
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 是否开启过期提醒
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package cn.iocoder.yudao.module.CouponTemplete.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券 - 优惠叠加类型
|
||||
*
|
||||
* @author Sin
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum CouponForbidPreferenceEnum {
|
||||
|
||||
UN_FORBID(0,"不限制"),
|
||||
FORBID(1,"优惠券仅原价购买商品时可用");
|
||||
|
||||
/**
|
||||
* 优惠券类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 优惠券类型名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
package cn.iocoder.yudao.module.CouponTemplete.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券 - 优惠券商品使用类型
|
||||
*
|
||||
* @author Sin
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum CouponGoodsTypeEnum {
|
||||
|
||||
ALL(1,"全部商品可用"),
|
||||
POINT_PRODUCT(2,"指定商品可用"),
|
||||
POINT_PRODUCT_NOT(3,"指定商品不可用"),;
|
||||
|
||||
/**
|
||||
* 优惠券商品使用类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 优惠券商品使用类型名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
package cn.iocoder.yudao.module.CouponTemplete.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券 - 优惠券状态类型
|
||||
*
|
||||
* @author Sin
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum CouponStatusTypeEnum {
|
||||
|
||||
PROCESSING(1,"进行中"),
|
||||
END(2,"已结束"),
|
||||
CLOSE(3,"已关闭"),;
|
||||
|
||||
/**
|
||||
* 优惠券类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 优惠券类型名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
}
|
||||
@ -1,30 +0,0 @@
|
||||
package cn.iocoder.yudao.module.CouponTemplete.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券 - 优惠券类型
|
||||
*
|
||||
* @author Sin
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum CouponTypeEnum {
|
||||
|
||||
REWARD(1,"满减"),
|
||||
DISCOUNT(2,"折扣"),
|
||||
RANDOW(3,"随机"),;
|
||||
|
||||
/**
|
||||
* 优惠券类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 优惠券类型名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package cn.iocoder.yudao.module.CouponTemplete.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券使用类型 - 优惠券使用类型类型
|
||||
*
|
||||
* @author Sin
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum CouponUseLimitEnum {
|
||||
|
||||
HAS_LIMIT(1,"无门槛"),
|
||||
NO_LIMIT(2,"有门槛"),;
|
||||
|
||||
/**
|
||||
* 优惠券使用类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 优惠券使用类型名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
}
|
||||
@ -1,29 +0,0 @@
|
||||
package cn.iocoder.yudao.module.CouponTemplete.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* 过期类型 - 状态
|
||||
*
|
||||
* @author Sin
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum CouponValidityTypeEnum {
|
||||
|
||||
TIME_RANGE_EXPIRTED(1,"时间范围过期"),
|
||||
EXPIRES_AFTER_FIXED_DATE(2,"领取之日固定日期后过期"),
|
||||
EXPIRES_DATE_NEXT_FIEXD_DATE(3,"领取次日固定日期后过期"),;
|
||||
|
||||
|
||||
/**
|
||||
* 状态值
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
}
|
||||
@ -1,88 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.controller.admin.coupon;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import javax.validation.*;
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
|
||||
import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
|
||||
import cn.iocoder.yudao.module.coupon.convert.coupon.CouponConvert;
|
||||
import cn.iocoder.yudao.module.coupon.service.coupon.CouponService;
|
||||
|
||||
@Api(tags = "管理后台 - 优惠券")
|
||||
@RestController
|
||||
@RequestMapping("/coupon/item")
|
||||
@Validated
|
||||
public class CouponController {
|
||||
|
||||
@Resource
|
||||
private CouponService couponService;
|
||||
|
||||
|
||||
//todo 用户优惠券
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("用户领取优惠券")
|
||||
@PreAuthorize("@ss.hasPermission('coupon::create')")
|
||||
public CommonResult<Long> create(@RequestParam("couponTemplateId") Long couponTemplateId) {
|
||||
|
||||
return success(couponService.create(couponTemplateId));
|
||||
}
|
||||
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("更新优惠券")
|
||||
@PreAuthorize("@ss.hasPermission('coupon::update')")
|
||||
public CommonResult<Boolean> update(@Valid @RequestBody CouponUpdateReqVO updateReqVO) {
|
||||
couponService.update(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除优惠券")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('coupon::delete')")
|
||||
public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
|
||||
couponService.delete(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得优惠券")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('coupon::query')")
|
||||
public CommonResult<CouponRespVO> get(@RequestParam("id") Long id) {
|
||||
CouponDO couponDO = couponService.get(id);
|
||||
return success(CouponConvert.INSTANCE.convert(couponDO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得优惠券列表")
|
||||
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
||||
@PreAuthorize("@ss.hasPermission('coupon::query')")
|
||||
public CommonResult<List<CouponRespVO>> getList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<CouponDO> list = couponService.getList(ids);
|
||||
return success(CouponConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得优惠券分页")
|
||||
@PreAuthorize("@ss.hasPermission('coupon::query')")
|
||||
public CommonResult<PageResult<CouponRespVO>> getPage(@Valid CouponPageReqVO pageVO) {
|
||||
PageResult<CouponDO> pageResult = couponService.getPage(pageVO);
|
||||
return success(CouponConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.annotations.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@ApiModel("管理后台 - 优惠券创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CouponCreateReqVO extends CouponBaseVO {
|
||||
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
@ApiModel("管理后台 - 优惠券 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CouponRespVO extends CouponBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "用户ID", required = true)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.annotations.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@ApiModel("管理后台 - 优惠券更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CouponUpdateReqVO extends CouponBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "用户ID", required = true)
|
||||
@NotNull(message = "用户ID不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@ -1,81 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.controller.admin.templete;
|
||||
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.*;
|
||||
import cn.iocoder.yudao.module.coupon.convert.CouponTemplete.CouponTempleteConvert;
|
||||
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
|
||||
import cn.iocoder.yudao.module.coupon.service.CouponTemplete.CouponTempleteService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
import javax.validation.*;
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "管理后台 - 优惠券模板")
|
||||
@RestController
|
||||
@RequestMapping("/coupon/template")
|
||||
@Validated
|
||||
public class CouponTempleteController {
|
||||
|
||||
@Resource
|
||||
private CouponTempleteService couponTempleteServiceService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建优惠券模板")
|
||||
@PreAuthorize("@ss.hasPermission('CouponTemplete::create')")
|
||||
public CommonResult<Long> create(@Valid @RequestBody CouponTempleteCreateReqVO createReqVO) {
|
||||
return success(couponTempleteServiceService.create(createReqVO));
|
||||
}
|
||||
|
||||
// @PutMapping("/update")
|
||||
// @ApiOperation("更新优惠券模板")
|
||||
// @PreAuthorize("@ss.hasPermission('CouponTemplete::update')")
|
||||
// public CommonResult<Boolean> update(@Valid @RequestBody CouponTempleteUpdateReqVO updateReqVO) {
|
||||
// couponTempleteServiceService.update(updateReqVO);
|
||||
// return success(true);
|
||||
// }
|
||||
//
|
||||
// @DeleteMapping("/delete")
|
||||
// @ApiOperation("删除优惠券模板")
|
||||
// @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
||||
// @PreAuthorize("@ss.hasPermission('CouponTemplete::delete')")
|
||||
// public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
|
||||
// couponTempleteServiceService.delete(id);
|
||||
// return success(true);
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/get")
|
||||
// @ApiOperation("获得优惠券模板")
|
||||
// @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
// @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
|
||||
// public CommonResult<CouponTempleteRespVO> get(@RequestParam("id") Long id) {
|
||||
// CouponTempleteDO couponTempleteDO = couponTempleteServiceService.get(id);
|
||||
// return success(CouponTempleteConvert.INSTANCE.convert(couponTempleteDO));
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/list")
|
||||
// @ApiOperation("获得优惠券模板列表")
|
||||
// @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
|
||||
// @PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
|
||||
// public CommonResult<List<CouponTempleteRespVO>> getList(@RequestParam("ids") Collection<Long> ids) {
|
||||
// List<CouponTempleteDO> list = couponTempleteServiceService.getList(ids);
|
||||
// return success(CouponTempleteConvert.INSTANCE.convertList(list));
|
||||
// }
|
||||
//
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得优惠券模板分页")
|
||||
@PreAuthorize("@ss.hasPermission('CouponTemplete::query')")
|
||||
public CommonResult<PageResult<CouponTempleteRespVO>> getPage(@Valid CouponTempletePageReqVO pageVO) {
|
||||
PageResult<CouponTempleteDO> pageResult = couponTempleteServiceService.getPage(pageVO);
|
||||
return success(CouponTempleteConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,12 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
@ApiModel("管理后台 - 优惠券模板创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CouponTempleteCreateReqVO extends CouponTempleteBaseVO {
|
||||
|
||||
}
|
||||
@ -1,20 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import io.swagger.annotations.*;
|
||||
|
||||
@ApiModel("管理后台 - 优惠券模板 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CouponTempleteRespVO extends CouponTempleteBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "用户ID", required = true)
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.controller.admin.templete.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@ApiModel("管理后台 - 优惠券模板更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CouponTempleteUpdateReqVO extends CouponTempleteBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "用户ID", required = true)
|
||||
@NotNull(message = "用户ID不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@ -1,38 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.convert.CouponTemplete;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteCreateReqVO;
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteExcelVO;
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteRespVO;
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券模板 Convert
|
||||
*
|
||||
* @author wxr
|
||||
*/
|
||||
@Mapper
|
||||
public interface CouponTempleteConvert {
|
||||
|
||||
CouponTempleteConvert INSTANCE = Mappers.getMapper(CouponTempleteConvert.class);
|
||||
|
||||
CouponTempleteDO convert(CouponTempleteCreateReqVO bean);
|
||||
|
||||
CouponTempleteDO convert(CouponTempleteUpdateReqVO bean);
|
||||
|
||||
CouponTempleteRespVO convert(CouponTempleteDO bean);
|
||||
|
||||
List<CouponTempleteRespVO> convertList(List<CouponTempleteDO> list);
|
||||
|
||||
PageResult<CouponTempleteRespVO> convertPage(PageResult<CouponTempleteDO> page);
|
||||
|
||||
List<CouponTempleteExcelVO> convertList02(List<CouponTempleteDO> list);
|
||||
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.convert.coupon;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
|
||||
import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
|
||||
|
||||
/**
|
||||
* 优惠券 Convert
|
||||
*
|
||||
* @author wxr
|
||||
*/
|
||||
@Mapper
|
||||
public interface CouponConvert {
|
||||
|
||||
CouponConvert INSTANCE = Mappers.getMapper(CouponConvert.class);
|
||||
|
||||
CouponDO convert(CouponCreateReqVO bean);
|
||||
|
||||
CouponDO convert(CouponUpdateReqVO bean);
|
||||
|
||||
CouponRespVO convert(CouponDO bean);
|
||||
|
||||
List<CouponRespVO> convertList(List<CouponDO> list);
|
||||
|
||||
PageResult<CouponRespVO> convertPage(PageResult<CouponDO> page);
|
||||
|
||||
List<CouponExcelVO> convertList02(List<CouponDO> list);
|
||||
|
||||
}
|
||||
@ -1,98 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempleteExportReqVO;
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.CouponTempletePageReqVO;
|
||||
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 优惠券模板 Mapper
|
||||
*
|
||||
* @author wxr
|
||||
*/
|
||||
@Mapper
|
||||
public interface CouponTempleteMapper extends BaseMapperX<CouponTempleteDO> {
|
||||
|
||||
default PageResult<CouponTempleteDO> selectPage(CouponTempletePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CouponTempleteDO>()
|
||||
.eqIfPresent(CouponTempleteDO::getType, reqVO.getType())
|
||||
.likeIfPresent(CouponTempleteDO::getName, reqVO.getName())
|
||||
.eqIfPresent(CouponTempleteDO::getCouponNameRemark, reqVO.getCouponNameRemark())
|
||||
.eqIfPresent(CouponTempleteDO::getImage, reqVO.getImage())
|
||||
.eqIfPresent(CouponTempleteDO::getCount, reqVO.getCount())
|
||||
.eqIfPresent(CouponTempleteDO::getLeadCount, reqVO.getLeadCount())
|
||||
.eqIfPresent(CouponTempleteDO::getUsedCount, reqVO.getUsedCount())
|
||||
.eqIfPresent(CouponTempleteDO::getGoodsType, reqVO.getGoodsType())
|
||||
.eqIfPresent(CouponTempleteDO::getProductIds, reqVO.getProductIds())
|
||||
.eqIfPresent(CouponTempleteDO::getHasUseLimit, reqVO.getHasUseLimit())
|
||||
.eqIfPresent(CouponTempleteDO::getAtLeast, reqVO.getAtLeast())
|
||||
.eqIfPresent(CouponTempleteDO::getMoney, reqVO.getMoney())
|
||||
.eqIfPresent(CouponTempleteDO::getDiscount, reqVO.getDiscount())
|
||||
.eqIfPresent(CouponTempleteDO::getDiscountLimit, reqVO.getDiscountLimit())
|
||||
.eqIfPresent(CouponTempleteDO::getMinMoney, reqVO.getMinMoney())
|
||||
.eqIfPresent(CouponTempleteDO::getMaxMoney, reqVO.getMaxMoney())
|
||||
.eqIfPresent(CouponTempleteDO::getValidityType, reqVO.getValidityType())
|
||||
.betweenIfPresent(CouponTempleteDO::getStartUseTime, reqVO.getStartUseTime())
|
||||
.betweenIfPresent(CouponTempleteDO::getEndUseTime, reqVO.getEndUseTime())
|
||||
.eqIfPresent(CouponTempleteDO::getFixedTerm, reqVO.getFixedTerm())
|
||||
.eqIfPresent(CouponTempleteDO::getWhetherLimitless, reqVO.getWhetherLimitless())
|
||||
.eqIfPresent(CouponTempleteDO::getMaxFetch, reqVO.getMaxFetch())
|
||||
.eqIfPresent(CouponTempleteDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
|
||||
.eqIfPresent(CouponTempleteDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
|
||||
.eqIfPresent(CouponTempleteDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
|
||||
.eqIfPresent(CouponTempleteDO::getWhetherShow, reqVO.getWhetherShow())
|
||||
.eqIfPresent(CouponTempleteDO::getDiscountOrderMoney, reqVO.getDiscountOrderMoney())
|
||||
.eqIfPresent(CouponTempleteDO::getOrderMoney, reqVO.getOrderMoney())
|
||||
.eqIfPresent(CouponTempleteDO::getWhetherForbidden, reqVO.getWhetherForbidden())
|
||||
.eqIfPresent(CouponTempleteDO::getOrderGoodsNum, reqVO.getOrderGoodsNum())
|
||||
.eqIfPresent(CouponTempleteDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(CouponTempleteDO::getEndTime, reqVO.getEndTime())
|
||||
.betweenIfPresent(CouponTempleteDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(CouponTempleteDO::getId));
|
||||
}
|
||||
|
||||
default List<CouponTempleteDO> selectList(CouponTempleteExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<CouponTempleteDO>()
|
||||
.eqIfPresent(CouponTempleteDO::getType, reqVO.getType())
|
||||
.likeIfPresent(CouponTempleteDO::getName, reqVO.getName())
|
||||
.eqIfPresent(CouponTempleteDO::getCouponNameRemark, reqVO.getCouponNameRemark())
|
||||
.eqIfPresent(CouponTempleteDO::getImage, reqVO.getImage())
|
||||
.eqIfPresent(CouponTempleteDO::getCount, reqVO.getCount())
|
||||
.eqIfPresent(CouponTempleteDO::getLeadCount, reqVO.getLeadCount())
|
||||
.eqIfPresent(CouponTempleteDO::getUsedCount, reqVO.getUsedCount())
|
||||
.eqIfPresent(CouponTempleteDO::getGoodsType, reqVO.getGoodsType())
|
||||
.eqIfPresent(CouponTempleteDO::getProductIds, reqVO.getProductIds())
|
||||
.eqIfPresent(CouponTempleteDO::getHasUseLimit, reqVO.getHasUseLimit())
|
||||
.eqIfPresent(CouponTempleteDO::getAtLeast, reqVO.getAtLeast())
|
||||
.eqIfPresent(CouponTempleteDO::getMoney, reqVO.getMoney())
|
||||
.eqIfPresent(CouponTempleteDO::getDiscount, reqVO.getDiscount())
|
||||
.eqIfPresent(CouponTempleteDO::getDiscountLimit, reqVO.getDiscountLimit())
|
||||
.eqIfPresent(CouponTempleteDO::getMinMoney, reqVO.getMinMoney())
|
||||
.eqIfPresent(CouponTempleteDO::getMaxMoney, reqVO.getMaxMoney())
|
||||
.eqIfPresent(CouponTempleteDO::getValidityType, reqVO.getValidityType())
|
||||
.betweenIfPresent(CouponTempleteDO::getStartUseTime, reqVO.getStartUseTime())
|
||||
.betweenIfPresent(CouponTempleteDO::getEndUseTime, reqVO.getEndUseTime())
|
||||
.eqIfPresent(CouponTempleteDO::getFixedTerm, reqVO.getFixedTerm())
|
||||
.eqIfPresent(CouponTempleteDO::getWhetherLimitless, reqVO.getWhetherLimitless())
|
||||
.eqIfPresent(CouponTempleteDO::getMaxFetch, reqVO.getMaxFetch())
|
||||
.eqIfPresent(CouponTempleteDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
|
||||
.eqIfPresent(CouponTempleteDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
|
||||
.eqIfPresent(CouponTempleteDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
|
||||
.eqIfPresent(CouponTempleteDO::getWhetherShow, reqVO.getWhetherShow())
|
||||
.eqIfPresent(CouponTempleteDO::getDiscountOrderMoney, reqVO.getDiscountOrderMoney())
|
||||
.eqIfPresent(CouponTempleteDO::getOrderMoney, reqVO.getOrderMoney())
|
||||
.eqIfPresent(CouponTempleteDO::getWhetherForbidden, reqVO.getWhetherForbidden())
|
||||
.eqIfPresent(CouponTempleteDO::getOrderGoodsNum, reqVO.getOrderGoodsNum())
|
||||
.eqIfPresent(CouponTempleteDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(CouponTempleteDO::getEndTime, reqVO.getEndTime())
|
||||
.betweenIfPresent(CouponTempleteDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(CouponTempleteDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,76 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.dal.mysql.coupon;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
|
||||
|
||||
/**
|
||||
* 优惠券 Mapper
|
||||
*
|
||||
* @author wxr
|
||||
*/
|
||||
@Mapper
|
||||
public interface CouponMapper extends BaseMapperX<CouponDO> {
|
||||
|
||||
default PageResult<CouponDO> selectPage(CouponPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CouponDO>()
|
||||
.eqIfPresent(CouponDO::getType, reqVO.getType())
|
||||
.likeIfPresent(CouponDO::getName, reqVO.getName())
|
||||
.eqIfPresent(CouponDO::getCouponTypeId, reqVO.getCouponTypeId())
|
||||
.eqIfPresent(CouponDO::getCouponCode, reqVO.getCouponCode())
|
||||
.eqIfPresent(CouponDO::getMemberId, reqVO.getMemberId())
|
||||
.eqIfPresent(CouponDO::getUseOrderId, reqVO.getUseOrderId())
|
||||
.eqIfPresent(CouponDO::getGoodsType, reqVO.getGoodsType())
|
||||
.eqIfPresent(CouponDO::getGoodsIds, reqVO.getGoodsIds())
|
||||
.eqIfPresent(CouponDO::getAtLeast, reqVO.getAtLeast())
|
||||
.eqIfPresent(CouponDO::getMoney, reqVO.getMoney())
|
||||
.eqIfPresent(CouponDO::getDiscount, reqVO.getDiscount())
|
||||
.eqIfPresent(CouponDO::getDiscountLimit, reqVO.getDiscountLimit())
|
||||
.eqIfPresent(CouponDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
|
||||
.eqIfPresent(CouponDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
|
||||
.eqIfPresent(CouponDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
|
||||
.eqIfPresent(CouponDO::getWhetherNoticed, reqVO.getWhetherNoticed())
|
||||
.eqIfPresent(CouponDO::getState, reqVO.getState())
|
||||
.eqIfPresent(CouponDO::getGetType, reqVO.getGetType())
|
||||
.betweenIfPresent(CouponDO::getFetchTime, reqVO.getFetchTime())
|
||||
.betweenIfPresent(CouponDO::getUseTime, reqVO.getUseTime())
|
||||
.betweenIfPresent(CouponDO::getStartTime, reqVO.getStartTime())
|
||||
.betweenIfPresent(CouponDO::getEndTime, reqVO.getEndTime())
|
||||
.betweenIfPresent(CouponDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(CouponDO::getId));
|
||||
}
|
||||
|
||||
default List<CouponDO> selectList(CouponExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<CouponDO>()
|
||||
.eqIfPresent(CouponDO::getType, reqVO.getType())
|
||||
.likeIfPresent(CouponDO::getName, reqVO.getName())
|
||||
.eqIfPresent(CouponDO::getCouponTypeId, reqVO.getCouponTypeId())
|
||||
.eqIfPresent(CouponDO::getCouponCode, reqVO.getCouponCode())
|
||||
.eqIfPresent(CouponDO::getMemberId, reqVO.getMemberId())
|
||||
.eqIfPresent(CouponDO::getUseOrderId, reqVO.getUseOrderId())
|
||||
.eqIfPresent(CouponDO::getGoodsType, reqVO.getGoodsType())
|
||||
.eqIfPresent(CouponDO::getGoodsIds, reqVO.getGoodsIds())
|
||||
.eqIfPresent(CouponDO::getAtLeast, reqVO.getAtLeast())
|
||||
.eqIfPresent(CouponDO::getMoney, reqVO.getMoney())
|
||||
.eqIfPresent(CouponDO::getDiscount, reqVO.getDiscount())
|
||||
.eqIfPresent(CouponDO::getDiscountLimit, reqVO.getDiscountLimit())
|
||||
.eqIfPresent(CouponDO::getWhetherForbidPreference, reqVO.getWhetherForbidPreference())
|
||||
.eqIfPresent(CouponDO::getWhetherExpireNotice, reqVO.getWhetherExpireNotice())
|
||||
.eqIfPresent(CouponDO::getExpireNoticeFixedTerm, reqVO.getExpireNoticeFixedTerm())
|
||||
.eqIfPresent(CouponDO::getWhetherNoticed, reqVO.getWhetherNoticed())
|
||||
.eqIfPresent(CouponDO::getState, reqVO.getState())
|
||||
.eqIfPresent(CouponDO::getGetType, reqVO.getGetType())
|
||||
.betweenIfPresent(CouponDO::getFetchTime, reqVO.getFetchTime())
|
||||
.betweenIfPresent(CouponDO::getUseTime, reqVO.getUseTime())
|
||||
.betweenIfPresent(CouponDO::getStartTime, reqVO.getStartTime())
|
||||
.betweenIfPresent(CouponDO::getEndTime, reqVO.getEndTime())
|
||||
.betweenIfPresent(CouponDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(CouponDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.service.CouponTemplete;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.templete.vo.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
|
||||
|
||||
/**
|
||||
* 优惠券模板 Service 接口
|
||||
*
|
||||
* @author wxr
|
||||
*/
|
||||
public interface CouponTempleteService {
|
||||
|
||||
/**
|
||||
* 创建优惠券模板
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long create(@Valid CouponTempleteCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新优惠券模板
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void update(@Valid CouponTempleteUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除优惠券模板
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void delete(Long id);
|
||||
|
||||
/**
|
||||
* 获得优惠券模板
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 优惠券模板
|
||||
*/
|
||||
CouponTempleteDO get(Long id);
|
||||
|
||||
/**
|
||||
* 获得优惠券模板列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 优惠券模板列表
|
||||
*/
|
||||
List<CouponTempleteDO> getList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得优惠券模板分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 优惠券模板分页
|
||||
*/
|
||||
PageResult<CouponTempleteDO> getPage(CouponTempletePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得优惠券模板列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 优惠券模板列表
|
||||
*/
|
||||
List<CouponTempleteDO> getList(CouponTempleteExportReqVO exportReqVO);
|
||||
|
||||
}
|
||||
@ -1,70 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.service.coupon;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
|
||||
import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 优惠券 Service 接口
|
||||
*
|
||||
* @author wxr
|
||||
*/
|
||||
public interface CouponService {
|
||||
|
||||
/**
|
||||
* 创建优惠券
|
||||
*
|
||||
* @param templateId 优惠券模板id
|
||||
* @return 编号
|
||||
*/
|
||||
Long create(Long templateId);
|
||||
|
||||
/**
|
||||
* 更新优惠券
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void update(@Valid CouponUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除优惠券
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void delete(Long id);
|
||||
|
||||
/**
|
||||
* 获得优惠券
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 优惠券
|
||||
*/
|
||||
CouponDO get(Long id);
|
||||
|
||||
/**
|
||||
* 获得优惠券列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 优惠券列表
|
||||
*/
|
||||
List<CouponDO> getList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得优惠券分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 优惠券分页
|
||||
*/
|
||||
PageResult<CouponDO> getPage(CouponPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得优惠券列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 优惠券列表
|
||||
*/
|
||||
List<CouponDO> getList(CouponExportReqVO exportReqVO);
|
||||
|
||||
}
|
||||
@ -1,106 +0,0 @@
|
||||
package cn.iocoder.yudao.module.coupon.service.coupon;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.coupon.dal.dataobject.CouponTemplete.CouponTempleteDO;
|
||||
import cn.iocoder.yudao.module.coupon.dal.mysql.CouponTemplete.CouponTempleteMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.coupon.controller.admin.coupon.vo.*;
|
||||
import cn.iocoder.yudao.module.coupon.dal.dataobject.coupon.CouponDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.coupon.convert.coupon.CouponConvert;
|
||||
import cn.iocoder.yudao.module.coupon.dal.mysql.coupon.CouponMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.CouponTemplete.enums.ErrorCodeConstants.COUPON_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 优惠券 Service 实现类
|
||||
*
|
||||
* @author wxr
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class CouponServiceImpl implements CouponService {
|
||||
|
||||
@Resource
|
||||
private CouponMapper couponMapper;
|
||||
|
||||
@Resource
|
||||
private CouponTempleteMapper couponTempleteMapper;
|
||||
|
||||
public Long create(CouponCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
CouponDO couponDO = CouponConvert.INSTANCE.convert(createReqVO);
|
||||
couponMapper.insert(couponDO);
|
||||
// 返回
|
||||
return couponDO.getId();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*todo 获取用户id收获优惠券
|
||||
*@author:wxr
|
||||
*@date:2022-08-13 3:11
|
||||
*@Description
|
||||
*/
|
||||
@Override
|
||||
public Long create(Long templateId) {
|
||||
Long userid = SecurityFrameworkUtils.getLoginUserId();
|
||||
CouponDO couponDO = CouponDO.builder().memberId(userid).build();
|
||||
CouponTempleteDO couponTempleteDO = couponTempleteMapper.selectById(templateId);
|
||||
//todo 缺少判空
|
||||
BeanUtil.copyProperties(couponTempleteDO,couponTempleteDO);
|
||||
couponMapper.insert(couponDO);
|
||||
return couponDO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(CouponUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
this.validateExists(updateReqVO.getId());
|
||||
// 更新
|
||||
CouponDO updateObj = CouponConvert.INSTANCE.convert(updateReqVO);
|
||||
couponMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(Long id) {
|
||||
// 校验存在
|
||||
this.validateExists(id);
|
||||
// 删除
|
||||
couponMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateExists(Long id) {
|
||||
if (couponMapper.selectById(id) == null) {
|
||||
throw exception(COUPON_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CouponDO get(Long id) {
|
||||
return couponMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CouponDO> getList(Collection<Long> ids) {
|
||||
return couponMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<CouponDO> getPage(CouponPageReqVO pageReqVO) {
|
||||
return couponMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CouponDO> getList(CouponExportReqVO exportReqVO) {
|
||||
return couponMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* 占位
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market.api;
|
||||
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* TODO 占位
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market.controller.admin.discount;
|
||||
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* TODO 占位
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market.convert.discount;
|
||||
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* TODO 占位
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market.dal.mysql.discount;
|
||||
@ -1,4 +0,0 @@
|
||||
/**
|
||||
* TODO 占位
|
||||
*/
|
||||
package cn.iocoder.yudao.module.market.service.discount;
|
||||
@ -1 +0,0 @@
|
||||
DELETE FROM "market_activity";
|
||||
@ -1,19 +0,0 @@
|
||||
CREATE TABLE IF NOT EXISTS "market_activity" (
|
||||
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||
"title" varchar(50) NOT NULL,
|
||||
"activity_type" tinyint(4) NOT NULL,
|
||||
"status" tinyint(4) NOT NULL,
|
||||
"start_time" datetime NOT NULL,
|
||||
"end_time" datetime NOT NULL,
|
||||
"invalid_time" datetime,
|
||||
"delete_time" datetime,
|
||||
"time_limited_discount" varchar(2000),
|
||||
"full_privilege" varchar(2000),
|
||||
"creator" varchar(64) DEFAULT '',
|
||||
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updater" varchar(64) DEFAULT '',
|
||||
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
"deleted" bit NOT NULL DEFAULT FALSE,
|
||||
"tenant_id" bigint(20) NOT NULL,
|
||||
PRIMARY KEY ("id")
|
||||
) COMMENT '促销活动';
|
||||
@ -1,30 +1,40 @@
|
||||
package cn.iocoder.yudao.module.product.api.sku;
|
||||
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.SkuDecrementStockBatchReqDTO;
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO;
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品 SKU API 接口
|
||||
*
|
||||
* @author LeeYan9
|
||||
* @since 2022-08-26
|
||||
*/
|
||||
public interface ProductSkuApi {
|
||||
|
||||
/**
|
||||
* 查询 SKU 信息
|
||||
*
|
||||
* @param id SKU 编号
|
||||
* @return SKU 信息
|
||||
*/
|
||||
ProductSkuRespDTO getSku(Long id);
|
||||
|
||||
/**
|
||||
* 根据skuId列表 查询sku信息
|
||||
* 批量查询 SKU 数组
|
||||
*
|
||||
* @param skuIds sku ID列表
|
||||
* @return sku信息列表
|
||||
* @param ids SKU 编号列表
|
||||
* @return SKU 数组
|
||||
*/
|
||||
List<SkuInfoRespDTO> getSkusByIds(Collection<Long> skuIds);
|
||||
List<ProductSkuRespDTO> getSkuList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 批量扣减sku库存
|
||||
* 更新 SKU 库存
|
||||
*
|
||||
* @param batchReqDTO sku库存信息列表
|
||||
* @param updateStockReqDTO 更新请求
|
||||
*/
|
||||
void decrementStockBatch(SkuDecrementStockBatchReqDTO batchReqDTO);
|
||||
void updateSkuStock(ProductSkuUpdateStockReqDTO updateStockReqDTO);
|
||||
|
||||
}
|
||||
|
||||
@ -1,23 +1,24 @@
|
||||
package cn.iocoder.yudao.module.product.api.spu;
|
||||
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO;
|
||||
import cn.iocoder.yudao.module.product.api.spu.dto.SpuInfoRespDTO;
|
||||
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 商品 SPU API 接口
|
||||
*
|
||||
* @author LeeYan9
|
||||
* @since 2022-08-26
|
||||
*/
|
||||
public interface ProductSpuApi {
|
||||
|
||||
|
||||
/**
|
||||
* 根据spuId列表 查询spu信息
|
||||
* 批量查询 SPU 数组
|
||||
*
|
||||
* @param spuIds spu ID列表
|
||||
* @return spu信息列表
|
||||
* @param ids SPU 编号列表
|
||||
* @return SPU 数组
|
||||
*/
|
||||
List<SpuInfoRespDTO> getSpusByIds(Collection<Long> spuIds);
|
||||
List<ProductSpuRespDTO> getSpuList(Collection<Long> ids);
|
||||
|
||||
}
|
||||
|
||||
@ -1,26 +1,49 @@
|
||||
package cn.iocoder.yudao.module.product.api.sku;
|
||||
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.SkuDecrementStockBatchReqDTO;
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.SkuInfoRespDTO;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
|
||||
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuUpdateStockReqDTO;
|
||||
import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
|
||||
import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* todo 注释
|
||||
* TODO LeeYan9: 类注释;
|
||||
* @author LeeYan9
|
||||
* @since 2022-09-06
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ProductSkuApiImpl implements ProductSkuApi {
|
||||
|
||||
@Resource
|
||||
private ProductSkuService productSkuService;
|
||||
|
||||
@Override
|
||||
public List<SkuInfoRespDTO> getSkusByIds(Collection<Long> skuIds) {
|
||||
public ProductSkuRespDTO getSku(Long id) {
|
||||
// TODO TODO LeeYan9: 需要实现
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrementStockBatch(SkuDecrementStockBatchReqDTO batchReqDTO) {
|
||||
public List<ProductSkuRespDTO> getSkuList(Collection<Long> ids) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ProductSkuDO> skus = productSkuService.getSkuList(ids);
|
||||
return ProductSkuConvert.INSTANCE.convertList04(skus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSkuStock(ProductSkuUpdateStockReqDTO updateStockReqDTO) {
|
||||
productSkuService.updateSkuStock(updateStockReqDTO);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,20 +1,38 @@
|
||||
package cn.iocoder.yudao.module.product.api.spu;
|
||||
|
||||
import cn.iocoder.yudao.module.product.api.spu.dto.SpuInfoRespDTO;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
|
||||
import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* todo 注释
|
||||
* TODO LeeYan9: 类注释;
|
||||
*
|
||||
* @author LeeYan9
|
||||
* @since 2022-09-06
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ProductSpuApiImpl implements ProductSpuApi {
|
||||
|
||||
@Resource
|
||||
private ProductSpuMapper productSpuMapper;
|
||||
|
||||
@Override
|
||||
public List<SpuInfoRespDTO> getSpusByIds(Collection<Long> spuIds) {
|
||||
return null;
|
||||
public List<ProductSpuRespDTO> getSpuList(Collection<Long> spuIds) {
|
||||
// TODO TODO LeeYan9: AllEmpty?
|
||||
if (CollectionUtils.isAnyEmpty(spuIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ProductSpuDO> productSpuDOList = productSpuMapper.selectBatchIds(spuIds);
|
||||
return ProductSpuConvert.INSTANCE.convertList2(productSpuDOList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.property;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyPageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueCreateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValuePageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "管理后台 - 规格值名称")
|
||||
@RestController
|
||||
@RequestMapping("/product/property/value")
|
||||
@Validated
|
||||
public class ProductPropertyValueController {
|
||||
|
||||
@Resource
|
||||
private ProductPropertyValueService productPropertyValueService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建规格名称")
|
||||
@PreAuthorize("@ss.hasPermission('product:property:create')")
|
||||
public CommonResult<Long> createProperty(@Valid @RequestBody ProductPropertyValueCreateReqVO createReqVO) {
|
||||
return success(productPropertyValueService.createPropertyValue(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("更新规格名称")
|
||||
@PreAuthorize("@ss.hasPermission('product:property:update')")
|
||||
public CommonResult<Boolean> updateProperty(@Valid @RequestBody ProductPropertyValueUpdateReqVO updateReqVO) {
|
||||
productPropertyValueService.updatePropertyValue(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除规格名称")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('product:property:delete')")
|
||||
public CommonResult<Boolean> deleteProperty(@RequestParam("id") Long id) {
|
||||
productPropertyValueService.deletePropertyValue(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得规格名称")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('product:property:query')")
|
||||
public CommonResult<ProductPropertyValueRespVO> getProperty(@RequestParam("id") Long id) {
|
||||
return success(productPropertyValueService.getPropertyValue(id));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得规格名称分页")
|
||||
@PreAuthorize("@ss.hasPermission('product:property:query')")
|
||||
public CommonResult<PageResult<ProductPropertyValueRespVO>> getPropertyValuePage(@Valid ProductPropertyValuePageReqVO pageVO) {
|
||||
return success(productPropertyValueService.getPropertyValueListPage(pageVO));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("管理后台 - 规格名称 List Request VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class ProductPropertyListReqVO {
|
||||
|
||||
@ApiModelProperty(value = "规格名称", example = "颜色")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.property.vo.property;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@ApiModel("管理后台 - 规格 + 规格值 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProductPropertyRespVO extends ProductPropertyBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "规格的编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.property.vo.value;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("管理后台 - 规格名称值分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProductPropertyValuePageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "规格id", example = "1024")
|
||||
private String propertyId;
|
||||
|
||||
@ApiModelProperty(value = "规格值", example = "红色")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@ -1,14 +1,57 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.sku;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuOptionRespVO;
|
||||
import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
|
||||
import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
|
||||
import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
|
||||
@Api(tags = "管理后台 - 商品 sku")
|
||||
@RestController
|
||||
@RequestMapping("/product/sku")
|
||||
@Validated
|
||||
public class ProductSkuController {
|
||||
|
||||
@Resource
|
||||
private ProductSkuService productSkuService;
|
||||
@Resource
|
||||
private ProductSpuService productSpuService;
|
||||
|
||||
@GetMapping("/get-option-list")
|
||||
@ApiOperation("获得商品 SKU 选项的列表")
|
||||
// @PreAuthorize("@ss.hasPermission('product:sku:query')")
|
||||
public CommonResult<List<ProductSkuOptionRespVO>> getSkuOptionList() {
|
||||
// 获得 SKU 列表
|
||||
List<ProductSkuDO> skus = productSkuService.getSkuList();
|
||||
if (CollUtil.isEmpty(skus)) {
|
||||
return success(Collections.emptyList());
|
||||
}
|
||||
|
||||
// 获得对应的 SPU 映射
|
||||
Map<Long, ProductSpuDO> spuMap = productSpuService.getSpuMap(convertSet(skus, ProductSkuDO::getSpuId));
|
||||
// 转换为返回结果
|
||||
List<ProductSkuOptionRespVO> skuVOs = ProductSkuConvert.INSTANCE.convertList05(skus);
|
||||
skuVOs.forEach(sku -> MapUtils.findAndThen(spuMap, sku.getSpuId(),
|
||||
spu -> sku.setSpuId(spu.getId()).setSpuName(spu.getName())));
|
||||
return success(skuVOs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.sku.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel(value = "管理后台 - 商品 SKU 选项 Response VO", description = "用于前端 SELECT 选项")
|
||||
@Data
|
||||
public class ProductSkuOptionRespVO {
|
||||
|
||||
@ApiModelProperty(value = "主键", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "商品 SKU 名字", example = "红色")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "销售价格", required = true, example = "100", notes = "单位:分")
|
||||
private String price;
|
||||
|
||||
@ApiModelProperty(value = "库存", required = true, example = "100")
|
||||
private Integer stock;
|
||||
|
||||
// ========== 商品 SPU 信息 ==========
|
||||
|
||||
@ApiModelProperty(value = "商品 SPU 编号", required = true, example = "1")
|
||||
private Long spuId;
|
||||
|
||||
@ApiModelProperty(value = "商品 SPU 名字", required = true, example = "iPhone 11")
|
||||
private String spuName;
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.spu.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("管理后台 - 商品 SPU 精简 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class ProductSpuSimpleRespVO extends ProductSpuBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "主键", required = true, example = "1")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "商品名称", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = " 最小价格,单位使用:分", required = true, example = "1024")
|
||||
private Integer minPrice;
|
||||
|
||||
@ApiModelProperty(value = "最大价格,单位使用:分", required = true, example = "1024")
|
||||
private Integer maxPrice;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue