- 修改:application old 改为 start
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package cn.iocoder.mall.promotion.application;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"cn.iocoder.mall.promotion"})
|
||||
public class PromotionApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(PromotionApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package cn.iocoder.mall.promotion.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.BannerService;
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerPageBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.BannerAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.BannerPageDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.BannerUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.application.convert.BannerConvert;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerPageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerVO;
|
||||
import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins/banner")
|
||||
@Api("Banner 模块")
|
||||
public class AdminsBannerController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.BannerService.version}")
|
||||
private BannerService bannerService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation(value = "Banner 分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "title", value = "标题,模糊匹配", example = "活动 A"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
|
||||
})
|
||||
public CommonResult<AdminsBannerPageVO> page(@RequestParam(value = "title", required = false) String title,
|
||||
@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
BannerPageBO result = bannerService.getBannerPage(new BannerPageDTO().setTitle(title).setPageNo(pageNo).setPageSize(pageSize));
|
||||
return success(BannerConvert.ADMINS.convert3(result));
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "创建 Banner")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "title", value = "标题", required = true, example = "活动A"),
|
||||
@ApiImplicitParam(name = "url", value = "跳转链接", required = true, example = "http://www.iocoder.cn"),
|
||||
@ApiImplicitParam(name = "picUrl", value = "图片链接", required = true, example = "http://www.iocoder.cn/01.jpg"),
|
||||
@ApiImplicitParam(name = "sort", value = "排序", required = true, example = "10"),
|
||||
@ApiImplicitParam(name = "memo", value = "备注", required = true, example = "活动很牛逼"),
|
||||
})
|
||||
public CommonResult<AdminsBannerVO> add(@RequestParam("title") String title,
|
||||
@RequestParam("url") String url,
|
||||
@RequestParam("picUrl") String picUrl,
|
||||
@RequestParam("sort") Integer sort,
|
||||
@RequestParam(value = "memo", required = false) String memo) {
|
||||
BannerAddDTO bannerAddDTO = new BannerAddDTO().setTitle(title).setUrl(url).setPicUrl(picUrl)
|
||||
.setSort(sort).setMemo(memo);
|
||||
return success(BannerConvert.ADMINS.convert(bannerService.addBanner(AdminSecurityContextHolder.getContext().getAdminId(), bannerAddDTO)));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "更新 Banner")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "Banner 编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "url", value = "跳转链接", required = true, example = "http://www.iocoder.cn"),
|
||||
@ApiImplicitParam(name = "picUrl", value = "图片链接", required = true, example = "http://www.iocoder.cn/01.jpg"),
|
||||
@ApiImplicitParam(name = "sort", value = "排序", required = true, example = "10"),
|
||||
@ApiImplicitParam(name = "memo", value = "备注", required = true, example = "活动很牛逼"),
|
||||
})
|
||||
public CommonResult<Boolean> update(@RequestParam("id") Integer id,
|
||||
@RequestParam("title") String title,
|
||||
@RequestParam("url") String url,
|
||||
@RequestParam("picUrl") String picUrl,
|
||||
@RequestParam("sort") Integer sort,
|
||||
@RequestParam(value = "memo", required = false) String memo) {
|
||||
BannerUpdateDTO bannerUpdateDTO = new BannerUpdateDTO().setId(id).setTitle(title).setUrl(url).setPicUrl(picUrl)
|
||||
.setSort(sort).setMemo(memo);
|
||||
return success(bannerService.updateBanner(AdminSecurityContextHolder.getContext().getAdminId(), bannerUpdateDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/update_status")
|
||||
@ApiOperation(value = "更新 Banner 状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "Banner 编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "status", value = "状态。1 - 开启;2 - 禁用", required = true, example = "1"),
|
||||
})
|
||||
public CommonResult<Boolean> updateStatus(@RequestParam("id") Integer id,
|
||||
@RequestParam("status") Integer status) {
|
||||
return success(bannerService.updateBannerStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status));
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation(value = "删除 Banner")
|
||||
@ApiImplicitParam(name = "id", value = "Banner 编号", required = true, example = "1")
|
||||
public CommonResult<Boolean> delete(@RequestParam("id") Integer id) {
|
||||
return success(bannerService.deleteBanner(AdminSecurityContextHolder.getContext().getAdminId(), id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package cn.iocoder.mall.promotion.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.util.DateUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.CouponService;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardTemplateUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponTemplatePageDTO;
|
||||
import cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO;
|
||||
import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins/coupon")
|
||||
@Api("优惠劵(码)模块")
|
||||
public class AdminsCouponController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.CouponService.version}")
|
||||
private CouponService couponService;
|
||||
|
||||
// ========== 优惠劵(码)模板 ==========
|
||||
|
||||
@GetMapping("/template/page")
|
||||
@ApiOperation(value = "优惠劵(码)模板分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "类型", example = "参考 CouponTemplateTypeEnum 枚举"),
|
||||
@ApiImplicitParam(name = "title", value = "标题,模糊匹配", example = "活动 A"),
|
||||
@ApiImplicitParam(name = "status", value = "状态", example = "参考 CouponTemplateStatusEnum 枚举"),
|
||||
@ApiImplicitParam(name = "preferentialType", value = "优惠类型", example = "参考 CouponTemplatePreferentialTypeEnum 枚举"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
|
||||
})
|
||||
public CommonResult<AdminsCouponTemplatePageVO> templatePage(@RequestParam(value = "type", required = false) Integer type,
|
||||
@RequestParam(value = "title", required = false) String title,
|
||||
@RequestParam(value = "status", required = false) Integer status,
|
||||
@RequestParam(value = "preferentialType", required = false) Integer preferentialType,
|
||||
@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
CouponTemplatePageBO result = couponService.getCouponTemplatePage(new CouponTemplatePageDTO()
|
||||
.setType(type).setTitle(title).setStatus(status).setPreferentialType(preferentialType)
|
||||
.setPageNo(pageNo).setPageSize(pageSize));
|
||||
return success(CouponTemplateConvert.ADMINS.convertPage(result));
|
||||
}
|
||||
|
||||
@PostMapping("/template/add_card")
|
||||
@ApiOperation(value = "创建优惠劵模板")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "title", value = "标题", required = true, example = "优惠劵牛逼"),
|
||||
@ApiImplicitParam(name = "description", value = "使用说明", example = "我只是描述"),
|
||||
@ApiImplicitParam(name = "quota", value = "每人限领个数", required = true),
|
||||
@ApiImplicitParam(name = "total", value = "发行总量"),
|
||||
@ApiImplicitParam(name = "priceAvailable", value = "是否设置满多少金额可用,单位:分", example = "0-不限制;大于0-多少金额可用"),
|
||||
@ApiImplicitParam(name = "rangeType", value = "可用范围的类型", required = true, example = "参见 CouponTemplateRangeTypeEnum 枚举"),
|
||||
@ApiImplicitParam(name = "rangeValues", value = "指定商品 / 分类列表,使用逗号分隔商品编号"),
|
||||
@ApiImplicitParam(name = "dateType", value = "生效日期类型", example = "参见 CouponTemplateDateTypeEnum 枚举"),
|
||||
@ApiImplicitParam(name = "validStartTime", value = "固定日期-生效开始时间", example = "当 dateType 为固定日期时,非空"),
|
||||
@ApiImplicitParam(name = "validEndTime", value = "固定日期-生效结束时间", example = "当 dateType 为固定日期时,非空"),
|
||||
@ApiImplicitParam(name = "fixedBeginTerm", value = "领取日期-开始天数", example = "当 dateType 为领取日期时,非空"),
|
||||
@ApiImplicitParam(name = "fixedEndTerm", value = "领取日期-结束天数", example = "当 dateType 为领取日期时,非空"),
|
||||
@ApiImplicitParam(name = "preferentialType", value = "优惠类型", example = "参见 CouponTemplatePreferentialTypeEnum 枚举"),
|
||||
@ApiImplicitParam(name = "priceOff", value = "优惠金额,单位:分", example = "当 preferentialType 为现金券时,非空"),
|
||||
@ApiImplicitParam(name = "percentOff", value = "折扣百分比", example = "当 preferentialType 为折扣卷时,非空"),
|
||||
@ApiImplicitParam(name = "discountPriceLimit", value = "折扣上限", example = "当 preferentialType 为折扣卷时,非空"),
|
||||
})
|
||||
public CommonResult<AdminsCouponTemplateVO> templateCardAdd(@RequestParam(value = "title") String title,
|
||||
@RequestParam(value = "description", required = false) String description,
|
||||
@RequestParam(value = "quota") Integer quota,
|
||||
@RequestParam(value = "total", required = false) Integer total,
|
||||
@RequestParam(value = "priceAvailable") Integer priceAvailable,
|
||||
@RequestParam(value = "rangeType") Integer rangeType,
|
||||
@RequestParam(value = "rangeValues", required = false) String rangeValues,
|
||||
@RequestParam(value = "dateType") Integer dateType,
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@RequestParam(value = "validStartTime", required = false) Date validStartTime,
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@RequestParam(value = "validEndTime", required = false) Date validEndTime,
|
||||
@RequestParam(value = "fixedBeginTerm", required = false) Integer fixedBeginTerm,
|
||||
@RequestParam(value = "fixedEndTerm", required = false) Integer fixedEndTerm,
|
||||
@RequestParam(value = "preferentialType") Integer preferentialType,
|
||||
@RequestParam(value = "priceOff", required = false) Integer priceOff,
|
||||
@RequestParam(value = "percentOff", required = false) Integer percentOff,
|
||||
@RequestParam(value = "discountPriceLimit", required = false) Integer discountPriceLimit) {
|
||||
// 创建 CouponCardTemplateAddDTO 对象
|
||||
validStartTime = DateUtil.getDayBegin(validStartTime); // 开始时间,以当前 00:00:00 为准
|
||||
validEndTime = DateUtil.getDayBegin(validEndTime); // 结束时间,以当前 25:59:59 为准
|
||||
CouponCardTemplateAddDTO couponCardTemplateAddDTO = new CouponCardTemplateAddDTO()
|
||||
.setTitle(title).setDescription(description)
|
||||
.setQuota(quota).setTotal(total)
|
||||
.setPriceAvailable(priceAvailable).setRangeType(rangeType).setRangeValues(rangeValues)
|
||||
.setDateType(dateType).setValidStartTime(validStartTime).setValidEndTime(validEndTime)
|
||||
.setFixedBeginTerm(fixedBeginTerm).setFixedEndTerm(fixedEndTerm)
|
||||
.setPreferentialType(preferentialType).setPriceOff(priceOff).setPercentOff(percentOff).setDiscountPriceLimit(discountPriceLimit);
|
||||
// 提交请求
|
||||
CouponTemplateBO result = couponService.addCouponCardTemplate(couponCardTemplateAddDTO);
|
||||
// 返回结果
|
||||
return success(CouponTemplateConvert.ADMINS.convert(result));
|
||||
}
|
||||
|
||||
@PostMapping("/template/update_card")
|
||||
@ApiOperation(value = "更新优惠劵模板")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "title", value = "标题", required = true, example = "优惠劵牛逼"),
|
||||
@ApiImplicitParam(name = "description", value = "使用说明", example = "我只是描述"),
|
||||
@ApiImplicitParam(name = "quota", value = "每人限领个数", required = true),
|
||||
@ApiImplicitParam(name = "total", value = "发行总量"),
|
||||
@ApiImplicitParam(name = "rangeType", value = "可用范围的类型", required = true, example = "参见 CouponTemplateRangeTypeEnum 枚举"),
|
||||
@ApiImplicitParam(name = "rangeValues", value = "指定商品 / 分类列表,使用逗号分隔商品编号"),
|
||||
})
|
||||
public CommonResult<Boolean> templateCardUpdate(@RequestParam(value = "id") Integer id,
|
||||
@RequestParam(value = "title") String title,
|
||||
@RequestParam(value = "description", required = false) String description,
|
||||
@RequestParam(value = "quota") Integer quota,
|
||||
@RequestParam(value = "total", required = false) Integer total,
|
||||
@RequestParam(value = "rangeType") Integer rangeType,
|
||||
@RequestParam(value = "rangeValues", required = false) String rangeValues) {
|
||||
// 创建 CouponCardTemplateAddDTO 对象
|
||||
CouponCardTemplateUpdateDTO couponCardTemplateUpdateDTO = new CouponCardTemplateUpdateDTO()
|
||||
.setId(id)
|
||||
.setTitle(title).setDescription(description)
|
||||
.setQuota(quota).setTotal(total)
|
||||
.setRangeType(rangeType).setRangeValues(rangeValues);
|
||||
return success(couponService.updateCouponCardTemplate(couponCardTemplateUpdateDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/template/update_status")
|
||||
@ApiOperation(value = "更新优惠劵(码)模板状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "Banner 编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "status", value = "状态。1 - 开启;2 - 禁用", required = true, example = "1"),
|
||||
})
|
||||
public CommonResult<Boolean> templateUpdateStatus(@RequestParam("id") Integer id,
|
||||
@RequestParam("status") Integer status) {
|
||||
return success(couponService.updateCouponTemplateStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status));
|
||||
}
|
||||
|
||||
// ========== 优惠劵 ==========
|
||||
|
||||
// ========== 优惠码 ==========
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package cn.iocoder.mall.promotion.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.product.api.ProductSpuService;
|
||||
import cn.iocoder.mall.product.api.bo.ProductSpuBO;
|
||||
import cn.iocoder.mall.promotion.api.ProductRecommendService;
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.ProductRecommendAddDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.ProductRecommendPageDTO;
|
||||
import cn.iocoder.mall.promotion.api.dto.ProductRecommendUpdateDTO;
|
||||
import cn.iocoder.mall.promotion.application.convert.ProductRecommendConvert;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendPageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendVO;
|
||||
import cn.iocoder.mall.security.core.context.AdminSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins/product_recommend")
|
||||
@Api("商品推荐模块")
|
||||
public class AdminsProductRecommendController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.ProductRecommendService.version}")
|
||||
private ProductRecommendService productRecommendService;
|
||||
@Reference(validation = "true", version = "${dubbo.consumer.ProductSpuService.version}")
|
||||
private ProductSpuService productSpuService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation(value = "商品推荐分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "推荐类型", example = "1"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
|
||||
})
|
||||
public CommonResult<AdminsProductRecommendPageVO> page(@RequestParam(value = "type", required = false) Integer type,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
ProductRecommendPageBO result = productRecommendService.getProductRecommendPage(new ProductRecommendPageDTO().setType(type).setPageNo(pageNo).setPageSize(pageSize));
|
||||
// 获得商品集合
|
||||
List<ProductSpuBO> spus = productSpuService.getProductSpuList(
|
||||
result.getList().stream().map(ProductRecommendBO::getProductSpuId).collect(Collectors.toSet()));
|
||||
Map<Integer, ProductSpuBO> spuMap = spus.stream().collect(Collectors.toMap(ProductSpuBO::getId, account -> account));
|
||||
// 拼装结果
|
||||
AdminsProductRecommendPageVO response = ProductRecommendConvert.INSTANCE.convert(result);
|
||||
response.getList().forEach(recommendVO -> recommendVO.setProductSpuName(spuMap.get(recommendVO.getProductSpuId()).getName()));
|
||||
return CommonResult.success(response);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation(value = "创建商品推荐")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "推荐类型", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "productSpuId", value = "商品编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "sort", value = "排序", required = true, example = "10"),
|
||||
@ApiImplicitParam(name = "memo", value = "备注", example = "活动很牛逼"),
|
||||
})
|
||||
public CommonResult<AdminsProductRecommendVO> add(@RequestParam("type") Integer type,
|
||||
@RequestParam("productSpuId") Integer productSpuId,
|
||||
@RequestParam("sort") Integer sort,
|
||||
@RequestParam(value = "memo", required = false) String memo) {
|
||||
ProductRecommendAddDTO bannerAddDTO = new ProductRecommendAddDTO().setType(type).setProductSpuId(productSpuId)
|
||||
.setSort(sort).setMemo(memo);
|
||||
return success(ProductRecommendConvert.INSTANCE.convert(productRecommendService.addProductRecommend(AdminSecurityContextHolder.getContext().getAdminId(), bannerAddDTO)));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "更新商品推荐")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "商品推荐编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "type", value = "推荐类型", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "productSpuId", value = "商品编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "sort", value = "排序", required = true, example = "10"),
|
||||
@ApiImplicitParam(name = "memo", value = "备注", example = "活动很牛逼"),
|
||||
})
|
||||
public CommonResult<Boolean> update(@RequestParam("id") Integer id,
|
||||
@RequestParam("type") Integer type,
|
||||
@RequestParam("productSpuId") Integer productSpuId,
|
||||
@RequestParam("sort") Integer sort,
|
||||
@RequestParam(value = "memo", required = false) String memo) {
|
||||
ProductRecommendUpdateDTO bannerUpdateDTO = new ProductRecommendUpdateDTO().setId(id).setType(type).setProductSpuId(productSpuId)
|
||||
.setSort(sort).setMemo(memo);
|
||||
return success(productRecommendService.updateProductRecommend(AdminSecurityContextHolder.getContext().getAdminId(), bannerUpdateDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/update_status")
|
||||
@ApiOperation(value = "更新商品推荐状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "商品推荐编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "status", value = "状态。1 - 开启;2 - 禁用", required = true, example = "1"),
|
||||
})
|
||||
public CommonResult<Boolean> updateStatus(@RequestParam("id") Integer id,
|
||||
@RequestParam("status") Integer status) {
|
||||
return success(productRecommendService.updateProductRecommendStatus(AdminSecurityContextHolder.getContext().getAdminId(), id, status));
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation(value = "删除商品推荐")
|
||||
@ApiImplicitParam(name = "id", value = "商品推荐编号", required = true, example = "1")
|
||||
public CommonResult<Boolean> delete(@RequestParam("id") Integer id) {
|
||||
return success(productRecommendService.deleteProductRecommend(AdminSecurityContextHolder.getContext().getAdminId(), id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package cn.iocoder.mall.promotion.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.PromotionActivityService;
|
||||
import cn.iocoder.mall.promotion.api.bo.PromotionActivityPageBO;
|
||||
import cn.iocoder.mall.promotion.api.constant.PromotionActivityStatusEnum;
|
||||
import cn.iocoder.mall.promotion.api.dto.PromotionActivityPageDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("admins/promotion_activity")
|
||||
@Api("促销活动模块")
|
||||
public class AdminsPromotionActivityController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.PromotionActivityService.version}")
|
||||
private PromotionActivityService promotionActivityService;
|
||||
|
||||
@GetMapping("/page") // TODO 芋艿,BO => VO
|
||||
public CommonResult<PromotionActivityPageBO> page(@RequestParam(value = "title", required = false) String title,
|
||||
@RequestParam(value = "activityType") Integer activityType,
|
||||
@RequestParam(value = "status") String status,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
PromotionActivityPageDTO promotionActivityPageDTO = new PromotionActivityPageDTO()
|
||||
.setTitle(title).setActivityType(activityType).setPageNo(pageNo).setPageSize(pageSize);
|
||||
switch (status) {
|
||||
case "WAIT":
|
||||
promotionActivityPageDTO.setStatuses(Collections.singleton(PromotionActivityStatusEnum.WAIT.getValue()));
|
||||
break;
|
||||
case "RUN":
|
||||
promotionActivityPageDTO.setStatuses(Collections.singleton(PromotionActivityStatusEnum.RUN.getValue()));
|
||||
break;
|
||||
case "END":
|
||||
promotionActivityPageDTO.setStatuses(Collections.singleton(PromotionActivityStatusEnum.END.getValue()));
|
||||
break;
|
||||
case "INVALID":
|
||||
promotionActivityPageDTO.setStatuses(Collections.singleton(PromotionActivityStatusEnum.INVALID.getValue()));
|
||||
break;
|
||||
default:
|
||||
promotionActivityPageDTO.setStatuses(Arrays.asList(PromotionActivityStatusEnum.WAIT.getValue(),
|
||||
PromotionActivityStatusEnum.RUN.getValue(), PromotionActivityStatusEnum.END.getValue(),
|
||||
PromotionActivityStatusEnum.INVALID.getValue()));
|
||||
}
|
||||
// 执行查询
|
||||
return success(promotionActivityService.getPromotionActivityPage(promotionActivityPageDTO));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.mall.promotion.application.controller.users;
|
||||
|
||||
import cn.iocoder.common.framework.constant.CommonStatusEnum;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.BannerService;
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerBO;
|
||||
import cn.iocoder.mall.promotion.application.convert.BannerConvert;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersBannerVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("users/banner")
|
||||
@Api("Banner 模块")
|
||||
public class UsersBannerController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.BannerService.version}")
|
||||
private BannerService bannerService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得所有 Banner 列表")
|
||||
public CommonResult<List<UsersBannerVO>> list() {
|
||||
// 查询 Banner 列表
|
||||
List<BannerBO> result = bannerService.getBannerListByStatus(CommonStatusEnum.ENABLE.getValue());
|
||||
// 排序,按照 sort 升序
|
||||
result.sort(Comparator.comparing(BannerBO::getSort));
|
||||
// 返回
|
||||
return CommonResult.success(BannerConvert.USERS.convertList(result));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package cn.iocoder.mall.promotion.application.controller.users;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.promotion.api.CouponService;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponCardBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponCardPageBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.dto.CouponCardPageDTO;
|
||||
import cn.iocoder.mall.promotion.application.convert.CouponCardConvert;
|
||||
import cn.iocoder.mall.promotion.application.convert.CouponTemplateConvert;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponCardPageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponCardVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponTemplateVO;
|
||||
import cn.iocoder.mall.security.core.context.UserSecurityContextHolder;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("users/coupon")
|
||||
@Api("优惠劵(码)模块")
|
||||
public class UsersCouponController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.CouponService.version}")
|
||||
private CouponService couponService;
|
||||
|
||||
// ========== 优惠劵(码)模板 ==========
|
||||
|
||||
@GetMapping("/template/get")
|
||||
@ApiOperation(value = "优惠劵(码)模板信息")
|
||||
@ApiImplicitParam(name = "id", value = "优惠劵(码)模板编号", required = true, example = "10")
|
||||
public CommonResult<UsersCouponTemplateVO> templateGet(@RequestParam("id") Integer id) {
|
||||
CouponTemplateBO template = couponService.getCouponTemplate(id);
|
||||
return success(CouponTemplateConvert.USERS.convert2(template));
|
||||
}
|
||||
|
||||
// ========== 优惠劵 ==========
|
||||
|
||||
@GetMapping("/card/page")
|
||||
@ApiOperation(value = "优惠劵分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "status", value = "状态", example = "参考 CouponCardStatusEnum 枚举"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
|
||||
})
|
||||
public CommonResult<UsersCouponCardPageVO> cardPage(@RequestParam(value = "status", required = false) Integer status,
|
||||
@RequestParam(value = "pageNo", defaultValue = "0") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
CouponCardPageBO result = couponService.getCouponCardPage(new CouponCardPageDTO()
|
||||
.setStatus(status).setUserId(UserSecurityContextHolder.getContext().getUserId())
|
||||
.setPageNo(pageNo).setPageSize(pageSize));
|
||||
return success(CouponCardConvert.INSTANCE.convert2(result));
|
||||
}
|
||||
|
||||
@PostMapping("/card/add")
|
||||
@ApiOperation(value = "领取优惠劵")
|
||||
@ApiImplicitParam(name = "templateId", value = "优惠劵(码)模板编号", required = true, example = "10")
|
||||
public CommonResult<UsersCouponCardVO> cardAdd(@RequestParam("templateId") Integer templateId) {
|
||||
CouponCardBO result = couponService.addCouponCard(UserSecurityContextHolder.getContext().getUserId(), templateId);
|
||||
return success(CouponCardConvert.INSTANCE.convert(result));
|
||||
}
|
||||
|
||||
// ========== 优惠码 ==========
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.iocoder.mall.promotion.application.controller.users;
|
||||
|
||||
import cn.iocoder.common.framework.constant.CommonStatusEnum;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.product.api.ProductSpuService;
|
||||
import cn.iocoder.mall.product.api.bo.ProductSpuBO;
|
||||
import cn.iocoder.mall.promotion.api.ProductRecommendService;
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
|
||||
import cn.iocoder.mall.promotion.application.convert.ProductRecommendConvert;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersProductRecommendVO;
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("users/product_recommend")
|
||||
@Api("商品推荐模块")
|
||||
public class UsersProductRecommendController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.ProductRecommendService.version}")
|
||||
private ProductRecommendService productRecommendService;
|
||||
@Reference(validation = "true", version = "${dubbo.consumer.ProductSpuService.version}")
|
||||
private ProductSpuService productSpuService;
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得所有 Banner 列表")
|
||||
public CommonResult<Map<Integer, Collection<UsersProductRecommendVO>>> list() {
|
||||
// 查询商品推荐列表
|
||||
List<ProductRecommendBO> productRecommends = productRecommendService.getProductRecommendList(
|
||||
null, CommonStatusEnum.ENABLE.getValue());
|
||||
// 获得商品集合
|
||||
List<ProductSpuBO> spus = productSpuService.getProductSpuList(
|
||||
productRecommends.stream().map(ProductRecommendBO::getProductSpuId).collect(Collectors.toSet()));
|
||||
Map<Integer, ProductSpuBO> spuMap = spus.stream().collect(Collectors.toMap(ProductSpuBO::getId, account -> account));
|
||||
// 组合结果,返回
|
||||
Multimap<Integer, UsersProductRecommendVO> result = HashMultimap.create();
|
||||
productRecommends.sort(Comparator.comparing(ProductRecommendBO::getSort)); // 排序,按照 sort 升序
|
||||
productRecommends.forEach(productRecommendBO -> result.put(productRecommendBO.getType(),
|
||||
ProductRecommendConvert.INSTANCE.convert(spuMap.get(productRecommendBO.getProductSpuId())))); // 将 ProductSpuBO 添加到 results 中
|
||||
return CommonResult.success(result.asMap());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.mall.promotion.application.convert;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.BannerPageBO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerPageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsBannerVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersBannerVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BannerConvert {
|
||||
|
||||
Users USERS = Mappers.getMapper(Users.class);
|
||||
|
||||
Admins ADMINS = Mappers.getMapper(Admins.class);
|
||||
|
||||
@Mapper
|
||||
interface Admins {
|
||||
|
||||
@Mappings({})
|
||||
AdminsBannerVO convert(BannerBO bannerBO);
|
||||
|
||||
@Mappings({})
|
||||
AdminsBannerPageVO convert3(BannerPageBO bannerPageBO);
|
||||
|
||||
}
|
||||
|
||||
@Mapper
|
||||
interface Users {
|
||||
|
||||
@Mappings({})
|
||||
List<UsersBannerVO> convertList(List<BannerBO> banners);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.iocoder.mall.promotion.application.convert;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponCardBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponCardPageBO;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponCardPageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponCardVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface CouponCardConvert {
|
||||
|
||||
CouponCardConvert INSTANCE = Mappers.getMapper(CouponCardConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
UsersCouponCardVO convert(CouponCardBO result);
|
||||
|
||||
@Mappings({})
|
||||
UsersCouponCardPageVO convert2(CouponCardPageBO result);
|
||||
|
||||
//
|
||||
// @Mappings({})
|
||||
// List<UsersCouponTemplateVO> convertList2(List<CouponTemplateBO> banners);
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package cn.iocoder.mall.promotion.application.convert;
|
||||
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplateBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.CouponTemplatePageBO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplatePageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsCouponTemplateVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersCouponTemplateVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface CouponTemplateConvert {
|
||||
|
||||
Users USERS = Mappers.getMapper(Users.class);
|
||||
|
||||
Admins ADMINS = Mappers.getMapper(Admins.class);
|
||||
|
||||
@Mapper
|
||||
interface Admins {
|
||||
|
||||
@Mappings({})
|
||||
AdminsCouponTemplateVO convert(CouponTemplateBO template);
|
||||
|
||||
@Mappings({})
|
||||
AdminsCouponTemplatePageVO convertPage(CouponTemplatePageBO result);
|
||||
|
||||
@Mappings({})
|
||||
List<AdminsCouponTemplateVO> convertList(List<CouponTemplateBO> templates);
|
||||
|
||||
}
|
||||
|
||||
@Mapper
|
||||
interface Users {
|
||||
|
||||
@Mappings({})
|
||||
UsersCouponTemplateVO convert2(CouponTemplateBO template);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.iocoder.mall.promotion.application.convert;
|
||||
|
||||
import cn.iocoder.mall.product.api.bo.ProductSpuBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendBO;
|
||||
import cn.iocoder.mall.promotion.api.bo.ProductRecommendPageBO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendPageVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.admins.AdminsProductRecommendVO;
|
||||
import cn.iocoder.mall.promotion.application.vo.users.UsersProductRecommendVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@Mapper
|
||||
public interface ProductRecommendConvert {
|
||||
|
||||
ProductRecommendConvert INSTANCE = Mappers.getMapper(ProductRecommendConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
AdminsProductRecommendVO convert(ProductRecommendBO bannerBO);
|
||||
|
||||
@Mappings({})
|
||||
AdminsProductRecommendPageVO convert(ProductRecommendPageBO result);
|
||||
|
||||
@Mappings({})
|
||||
UsersProductRecommendVO convert(ProductSpuBO productSpu);
|
||||
|
||||
// @Mappings({})
|
||||
// List<UsersProductRecommendVO> convertList(List<ProductRecommendBO> banners);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("Banner 分页 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsBannerPageVO {
|
||||
|
||||
@ApiModelProperty(value = "Banner 数组")
|
||||
private List<AdminsBannerVO> list;
|
||||
@ApiModelProperty(value = "Banner 总数")
|
||||
private Integer total;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("Banner VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsBannerVO {
|
||||
|
||||
@ApiModelProperty(value = "Banner 编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "标题", required = true, example = "活动 A")
|
||||
private String title;
|
||||
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com")
|
||||
private String url;
|
||||
@ApiModelProperty(value = "图片链接", required = true, example = "http://www.iocoder.cn/01.jpg")
|
||||
private String picUrl;
|
||||
@ApiModelProperty(value = "排序", required = true, example = "10")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "备注", required = true, example = "这个活动很牛逼")
|
||||
private String memo;
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("优惠劵(码)分页 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsCouponTemplatePageVO {
|
||||
|
||||
@ApiModelProperty(value = "优惠劵(码)数组")
|
||||
private List<AdminsCouponTemplateVO> list;
|
||||
@ApiModelProperty(value = "优惠劵(码)总数")
|
||||
private Integer total;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("CouponTemplate VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsCouponTemplateVO {
|
||||
|
||||
// ========== 基本信息 BEGIN ==========
|
||||
@ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼")
|
||||
private String title;
|
||||
@ApiModelProperty(value = "使用说明", required = true, example = "我只是描述")
|
||||
private String description;
|
||||
@ApiModelProperty(value = "优惠劵类型", required = true, example = "参见 CouponTemplateTypeEnum 枚举")
|
||||
private Integer type;
|
||||
/**
|
||||
* 码类型
|
||||
*
|
||||
* 1-一卡一码(UNIQUE)
|
||||
* 2-通用码(GENERAL)
|
||||
*
|
||||
* 【优惠码独有】 @see CouponCodeDO
|
||||
*/
|
||||
// TODO
|
||||
private Integer codeType;
|
||||
@ApiModelProperty(value = "优惠码状态", required = true, example = "参见 CouponTemplateStatusEnum 枚举")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "每人限领个数", example = "null - 则表示不限制")
|
||||
private Integer quota;
|
||||
@ApiModelProperty(value = "发放总量")
|
||||
private Integer total;
|
||||
// ========== 领取规则 END ==========
|
||||
|
||||
// ========== 使用规则 BEGIN ==========
|
||||
@ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true, example = "0-不限制;大于0-多少金额可用")
|
||||
private Integer priceAvailable;
|
||||
@ApiModelProperty(value = "可用范围的类型", required = true, example = "参见 CouponTemplateRangeTypeEnum 枚举")
|
||||
private Integer rangeType;
|
||||
@ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "参见 CouponTemplateRangeTypeEnum 枚举")
|
||||
private String rangeValues;
|
||||
@ApiModelProperty(value = "生效日期类型", example = "参见 CouponTemplateDateTypeEnum 枚举")
|
||||
private Integer dateType;
|
||||
@ApiModelProperty(value = "固定日期-生效开始时间")
|
||||
private Date validStartTime;
|
||||
@ApiModelProperty(value = "固定日期-生效结束时间")
|
||||
private Date validEndTime;
|
||||
@ApiModelProperty(value = "领取日期-开始天数", example = "例如,0-当天;1-次天")
|
||||
private Integer fixedStartTerm;
|
||||
@ApiModelProperty(value = "领取日期-结束天数")
|
||||
private Integer fixedEndTerm;
|
||||
// ========== 使用规则 END ==========
|
||||
|
||||
// ========== 使用效果 BEGIN ==========
|
||||
@ApiModelProperty(value = "优惠类型", required = true, example = "参见 CouponTemplatePreferentialTypeEnum 枚举")
|
||||
private Integer preferentialType;
|
||||
@ApiModelProperty(value = "折扣百分比")
|
||||
private Integer percentOff;
|
||||
@ApiModelProperty(value = "优惠金额,单位:分")
|
||||
private Integer priceOff;
|
||||
@ApiModelProperty(value = "折扣上限")
|
||||
private Integer discountPriceLimit;
|
||||
// ========== 使用效果 END ==========
|
||||
|
||||
// ========== 统计信息 BEGIN ==========
|
||||
@ApiModelProperty(value = "领取优惠券的次数", required = true)
|
||||
private Integer statFetchNum;
|
||||
// ========== 统计信息 END ==========
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("商品推荐分页 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsProductRecommendPageVO {
|
||||
|
||||
@ApiModelProperty(value = "商品推荐数组")
|
||||
private List<AdminsProductRecommendVO> list;
|
||||
@ApiModelProperty(value = "商品推荐总数")
|
||||
private Integer total;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("商品推荐 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsProductRecommendVO {
|
||||
|
||||
@ApiModelProperty(value = "编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "推荐类型", required = true, example = "1")
|
||||
private Integer type;
|
||||
@ApiModelProperty(value = "商品编号", required = true, example = "1")
|
||||
private Integer productSpuId;
|
||||
@ApiModelProperty(value = "排序", required = true, example = "10")
|
||||
private Integer sort;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "备注", required = true, example = "这个活动很牛逼")
|
||||
private String memo;
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
// ========== 基本信息 =========
|
||||
@ApiModelProperty(value = "SPU 名字", required = true, example = "厮大牛逼")
|
||||
private String productSpuName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ApiModel("Banner VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UsersBannerVO {
|
||||
|
||||
@ApiModelProperty(value = "跳转链接", required = true, example = "http://www.baidu.com")
|
||||
private String url;
|
||||
@ApiModelProperty(value = "图片链接", required = true, example = "http://www.iocoder.cn/01.jpg")
|
||||
private String picUrl;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("优惠劵分页 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UsersCouponCardPageVO {
|
||||
|
||||
@ApiModelProperty(value = "优惠劵数组")
|
||||
private List<UsersCouponCardVO> list;
|
||||
@ApiModelProperty(value = "优惠劵总数")
|
||||
private Integer total;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 优惠劵 VO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UsersCouponCardVO {
|
||||
|
||||
// ========== 基本信息 BEGIN ==========
|
||||
@ApiModelProperty(value = "优惠劵编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
|
||||
private Integer templateId;
|
||||
@ApiModelProperty(value = "优惠劵名", required = true, example = "大保剑")
|
||||
private String title;
|
||||
@ApiModelProperty(value = "优惠码状态", required = true, example = "参见 CouponCardStatusEnum 枚举")
|
||||
private Integer status;
|
||||
|
||||
// ========== 基本信息 END ==========
|
||||
|
||||
// ========== 使用规则 BEGIN ==========
|
||||
@ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true)
|
||||
private Integer priceAvailable;
|
||||
@ApiModelProperty(value = "固定日期-生效开始时间", required = true)
|
||||
private Date validStartTime;
|
||||
@ApiModelProperty(value = "固定日期-生效结束时间", required = true)
|
||||
private Date validEndTime;
|
||||
// ========== 使用规则 END ==========
|
||||
|
||||
// ========== 使用效果 BEGIN ==========
|
||||
@ApiModelProperty(value = "优惠类型", required = true, example = "参见 CouponTemplatePreferentialTypeEnum 枚举")
|
||||
private Integer preferentialType;
|
||||
@ApiModelProperty(value = "折扣百分比")
|
||||
private Integer percentOff;
|
||||
@ApiModelProperty(value = "优惠金额,单位:分")
|
||||
private Integer priceOff;
|
||||
@ApiModelProperty(value = "折扣上限")
|
||||
private Integer discountPriceLimit;
|
||||
// ========== 使用效果 END ==========
|
||||
|
||||
// ========== 使用情况 BEGIN ==========
|
||||
|
||||
// TODO 芋艿,后续要加优惠劵的使用日志,因为下单后,可能会取消。
|
||||
|
||||
// ========== 使用情况 END ==========
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("CouponTemplate VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UsersCouponTemplateVO {
|
||||
|
||||
// ========== 基本信息 BEGIN ==========
|
||||
@ApiModelProperty(value = "模板编号,自增唯一", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "标题", required = true, example = "优惠劵牛逼")
|
||||
private String title;
|
||||
@ApiModelProperty(value = "优惠码状态", required = true, example = "参见 CouponTemplateStatusEnum 枚举")
|
||||
private Integer status;
|
||||
// ========== 领取规则 END ==========
|
||||
|
||||
// ========== 使用规则 BEGIN ==========
|
||||
@ApiModelProperty(value = "是否设置满多少金额可用,单位:分", required = true, example = "0-不限制;大于0-多少金额可用")
|
||||
private Integer priceAvailable;
|
||||
@ApiModelProperty(value = "可用范围的类型", required = true, example = "参见 CouponTemplateRangeTypeEnum 枚举")
|
||||
private Integer rangeType;
|
||||
@ApiModelProperty(value = "指定商品 / 分类列表,使用逗号分隔商品编号", example = "参见 CouponTemplateRangeTypeEnum 枚举")
|
||||
private String rangeValues;
|
||||
@ApiModelProperty(value = "生效日期类型", example = "参见 CouponTemplateDateTypeEnum 枚举")
|
||||
private Integer dateType;
|
||||
@ApiModelProperty(value = "固定日期-生效开始时间")
|
||||
private Date validStartTime;
|
||||
@ApiModelProperty(value = "固定日期-生效结束时间")
|
||||
private Date validEndTime;
|
||||
@ApiModelProperty(value = "领取日期-开始天数", example = "例如,0-当天;1-次天")
|
||||
private Integer fixedStartTerm;
|
||||
@ApiModelProperty(value = "领取日期-结束天数")
|
||||
private Integer fixedEndTerm;
|
||||
// ========== 使用规则 END ==========
|
||||
|
||||
// ========== 使用效果 BEGIN ==========
|
||||
@ApiModelProperty(value = "优惠类型", required = true, example = "参见 CouponTemplatePreferentialTypeEnum 枚举")
|
||||
private Integer preferentialType;
|
||||
@ApiModelProperty(value = "折扣百分比")
|
||||
private Integer percentOff;
|
||||
@ApiModelProperty(value = "优惠金额,单位:分")
|
||||
private Integer priceOff;
|
||||
@ApiModelProperty(value = "折扣上限")
|
||||
private Integer discountPriceLimit;
|
||||
// ========== 使用效果 END ==========
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.mall.promotion.application.vo.users;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "商品推荐 VO", description = "不包括 SKU 信息 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UsersProductRecommendVO {
|
||||
|
||||
@ApiModelProperty(value = "商品 SPU 编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
|
||||
// ========== 基本信息 =========
|
||||
@ApiModelProperty(value = "SPU 名字", required = true, example = "厮大牛逼")
|
||||
private String name;
|
||||
@ApiModelProperty(value = "卖点", required = true, example = "各种 MQ 骚操作")
|
||||
private String sellPoint;
|
||||
@ApiModelProperty(value = "商品主图地址的数组", required = true, example = "http://www.iocoder.cn")
|
||||
private List<String> picUrls;
|
||||
|
||||
// ========== Sku 相关字段 =========
|
||||
/**
|
||||
* 价格
|
||||
*
|
||||
* 目前的计算方式是,以 Sku 最小价格为准
|
||||
*/
|
||||
private Integer price;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
swagger:
|
||||
enable: false
|
||||
title: 营销子系统
|
||||
description: 营销子系统
|
||||
version: 1.0.0
|
||||
base-package: cn.iocoder.mall.promotion.application.controller
|
||||
@@ -0,0 +1,33 @@
|
||||
spring:
|
||||
application:
|
||||
name: promotion-application
|
||||
|
||||
# Spring Cloud 配置项
|
||||
cloud:
|
||||
# Spring Cloud Sentinel 配置项
|
||||
sentinel:
|
||||
transport:
|
||||
dashboard: s1.iocoder.cn:12088 # Sentinel Dashboard 服务地址
|
||||
eager: true # 项目启动时,直接连接到 Sentinel
|
||||
|
||||
# server
|
||||
server:
|
||||
port: 18085
|
||||
servlet:
|
||||
context-path: /promotion-api/
|
||||
|
||||
swagger:
|
||||
enable: true
|
||||
title: 促销子系统
|
||||
description: 促销子系统
|
||||
version: 1.0.0
|
||||
base-package: cn.iocoder.mall.promotion.application.controller
|
||||
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,env,metrics,prometheus
|
||||
metrics:
|
||||
enabled: true
|
||||
Reference in New Issue
Block a user