diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/PromotionActivityController.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/PromotionActivityController.java new file mode 100644 index 00000000..b1baaea9 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/PromotionActivityController.java @@ -0,0 +1,36 @@ +package cn.iocoder.mall.managementweb.controller.promotion.activity; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO; +import cn.iocoder.mall.managementweb.manager.promotion.activity.PromotionActivityManager; +import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; +import cn.iocoder.security.annotations.RequiresPermissions; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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 static cn.iocoder.common.framework.vo.CommonResult.success; + +@RestController +@RequestMapping("/promotion/activity") +@Api(tags = "促销活动 API") +@Validated +public class PromotionActivityController { + + @Autowired + private PromotionActivityManager promotionActivityManager; + + // TODO 芋艿:DTO => VO + @GetMapping("/page") + @ApiOperation("获得促销活动分页") + @RequiresPermissions("promotion:activity:page") + public CommonResult> pagePromotionActivity(PromotionActivityPageReqVO pageReqVO) { + return success(promotionActivityManager.pagePromotionActivity(pageReqVO)); + } + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/vo/PromotionActivityPageReqVO.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/vo/PromotionActivityPageReqVO.java new file mode 100644 index 00000000..c784119a --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/activity/vo/PromotionActivityPageReqVO.java @@ -0,0 +1,26 @@ +package cn.iocoder.mall.managementweb.controller.promotion.activity.vo; + +import cn.iocoder.common.framework.vo.PageParam; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.Collection; + +/** + * 促销活动分页 Request DTO + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +public class PromotionActivityPageReqVO extends PageParam { + + @ApiModelProperty(value = "标题", example = "优惠劵牛逼") + private String title; + @ApiModelProperty(value = "活动类型", example = "1", notes = "参见 PromotionActivityTypeEnum 枚举") + private Integer activityType; + @ApiModelProperty(value = "状态数组", example = "1,2", notes = "参考 PromotionActivityStatusEnum 枚举") + private Collection statuses; + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/CouponTemplateController.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/CouponTemplateController.java index b04758be..c88d3c4a 100644 --- a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/CouponTemplateController.java +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/controller/promotion/coupon/CouponTemplateController.java @@ -20,9 +20,6 @@ import javax.validation.Valid; import static cn.iocoder.common.framework.vo.CommonResult.success; -/** - * 优惠劵模板 Controller - */ @RestController @RequestMapping("/promotion/coupon-template") @Api(tags = "优惠劵(码)模板 API") diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/activity/PromotionActivityConvert.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/activity/PromotionActivityConvert.java new file mode 100644 index 00000000..ca01430d --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/convert/promotion/activity/PromotionActivityConvert.java @@ -0,0 +1,15 @@ +package cn.iocoder.mall.managementweb.convert.promotion.activity; + +import cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO; +import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface PromotionActivityConvert { + + PromotionActivityConvert INSTANCE = Mappers.getMapper(PromotionActivityConvert.class); + + PromotionActivityPageReqDTO convert(PromotionActivityPageReqVO bean); + +} diff --git a/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/activity/PromotionActivityManager.java b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/activity/PromotionActivityManager.java new file mode 100644 index 00000000..16146381 --- /dev/null +++ b/management-web-app/src/main/java/cn/iocoder/mall/managementweb/manager/promotion/activity/PromotionActivityManager.java @@ -0,0 +1,30 @@ +package cn.iocoder.mall.managementweb.manager.promotion.activity; + +import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; +import cn.iocoder.mall.managementweb.controller.promotion.activity.vo.PromotionActivityPageReqVO; +import cn.iocoder.mall.managementweb.convert.promotion.activity.PromotionActivityConvert; +import cn.iocoder.mall.promotion.api.rpc.activity.PromotionActivityRpc; +import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; +import org.apache.dubbo.config.annotation.DubboReference; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +/** + * 促销活动 Manager + */ +@Service +@Validated +public class PromotionActivityManager { + + @DubboReference(version = "${dubbo.consumer.PromotionActivityRpc.version}") + private PromotionActivityRpc promotionActivityRpc; + + public PageResult pagePromotionActivity(PromotionActivityPageReqVO pageReqVO) { + CommonResult> pagePromotionActivityResult = promotionActivityRpc.pagePromotionActivity( + PromotionActivityConvert.INSTANCE.convert(pageReqVO)); + pagePromotionActivityResult.checkError(); + return pagePromotionActivityResult.getData(); + } + +} diff --git a/management-web-app/src/main/resources/application.yml b/management-web-app/src/main/resources/application.yml index 4f6c8775..01402aa2 100644 --- a/management-web-app/src/main/resources/application.yml +++ b/management-web-app/src/main/resources/application.yml @@ -59,6 +59,8 @@ dubbo: version: 1.0.0 CouponTemplateRpc: version: 1.0.0 + PromotionActivityRpc: + version: 1.0.0 # Swagger 配置项 swagger: diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityTypeEnum.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityTypeEnum.java index ae66aef1..a4cbe9fd 100644 --- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityTypeEnum.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/enums/activity/PromotionActivityTypeEnum.java @@ -1,7 +1,7 @@ package cn.iocoder.mall.promotion.api.enums.activity; /** - * 推广活动类型枚举 + * 促销活动类型枚举 */ public enum PromotionActivityTypeEnum { diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityRpc.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityRpc.java index 62071882..cca8e08a 100644 --- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityRpc.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/PromotionActivityRpc.java @@ -1,20 +1,19 @@ package cn.iocoder.mall.promotion.api.rpc.activity; import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityListReqDTO; +import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO; import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; import java.util.List; +/** + * 促销活动 Rpc 接口 + */ public interface PromotionActivityRpc { -// List getPromotionActivityListBySpuId(Integer spuId, -// Collection activityStatuses); -// -// List getPromotionActivityListBySpuIds(Collection spuIds, -// Collection activityStatuses); -// -// PromotionActivityPageReqDTO getPromotionActivityPage(PromotionActivityPageRespDTO promotionActivityPageDTO); + CommonResult> pagePromotionActivity(PromotionActivityPageReqDTO pageReqDTO); CommonResult> listPromotionActivities(PromotionActivityListReqDTO listReqDTO); diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java index 26f7f3be..127d7b0d 100644 --- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageReqDTO.java @@ -1,24 +1,33 @@ package cn.iocoder.mall.promotion.api.rpc.activity.dto; +import cn.iocoder.common.framework.vo.PageParam; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; -import java.util.List; +import java.util.Collection; /** - * 促销活动分页 BO + * 促销活动分页 Request DTO */ @Data +@EqualsAndHashCode(callSuper = true) @Accessors(chain = true) -public class PromotionActivityPageReqDTO { +public class PromotionActivityPageReqDTO extends PageParam { /** - * PromotionActivityBO 数组 + * 标题 + * + * 模糊匹配 */ - private List list; + private String title; /** - * 总量 + * 活动类型 */ - private Integer total; + private Integer activityType; + /** + * 状态 + */ + private Collection statuses; } diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageRespDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageRespDTO.java deleted file mode 100644 index 06b39bc4..00000000 --- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityPageRespDTO.java +++ /dev/null @@ -1,37 +0,0 @@ -package cn.iocoder.mall.promotion.api.rpc.activity.dto; - -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.Collection; - -/** - * 商品推荐分页 DTO - */ -@Data -@Accessors(chain = true) -public class PromotionActivityPageRespDTO implements Serializable { - - /** - * 标题 - * - * 模糊匹配 - */ - private String title; - /** - * 活动类型 - */ - private Integer activityType; - /** - * 状态 - */ - private Collection statuses; - - @NotNull(message = "页码不能为空") - private Integer pageNo; - @NotNull(message = "每页条数不能为空") - private Integer pageSize; - -} diff --git a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java index e0f76ca8..e4c1c812 100644 --- a/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java +++ b/promotion-service-project/promotion-service-api/src/main/java/cn/iocoder/mall/promotion/api/rpc/activity/dto/PromotionActivityRespDTO.java @@ -52,6 +52,10 @@ public class PromotionActivityRespDTO implements Serializable { * 满减送 */ private FullPrivilege fullPrivilege; + /** + * 创建时间 + */ + private Date createTime; /** * 限时折扣 diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/activity/PromotionActivityConvert.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/activity/PromotionActivityConvert.java index e9594c43..b3f9e8a5 100644 --- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/activity/PromotionActivityConvert.java +++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/convert/activity/PromotionActivityConvert.java @@ -1,10 +1,11 @@ package cn.iocoder.mall.promotionservice.convert.activity; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.activity.PromotionActivityDO; -import cn.iocoder.mall.promotionservice.service.activity.bo.PromotionActivityBO; +import com.baomidou.mybatisplus.core.metadata.IPage; import org.mapstruct.Mapper; -import org.mapstruct.Mappings; +import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; import java.util.List; @@ -14,24 +15,9 @@ public interface PromotionActivityConvert { PromotionActivityConvert INSTANCE = Mappers.getMapper(PromotionActivityConvert.class); - @Mappings({}) - PromotionActivityBO convertToBO(PromotionActivityDO activity); - - @Mappings({}) - List convertToBO(List activityList); - - @Mappings({}) - List convertToDO(List activityList); - - @Mappings({}) - List convertToRespDTO(List activityList); - List convertList(List list); -// @Mappings({}) -// PromotionActivityDO convert(PromotionActivityAddDTO activityAddDTO); -// -// @Mappings({}) -// PromotionActivityDO convert(PromotionActivityUpdateDTO activityUpdateDTO); + @Mapping(source = "records", target = "list") + PageResult convertPage(IPage page); } diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapper.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapper.java index 86d6fc18..c23c0be2 100644 --- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapper.java +++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/dal/mysql/mapper/activity/PromotionActivityMapper.java @@ -2,10 +2,12 @@ package cn.iocoder.mall.promotionservice.dal.mysql.mapper.activity; import cn.iocoder.mall.mybatis.core.query.QueryWrapperX; import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityListReqDTO; +import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO; import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.activity.PromotionActivityDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.springframework.stereotype.Repository; import java.util.Collection; @@ -14,19 +16,16 @@ import java.util.List; @Repository public interface PromotionActivityMapper extends BaseMapper { - default List selectListByStatus(@Param("statuses") Collection statuses) { + default List selectListByStatus(Collection statuses) { return selectList(new QueryWrapper().in("status", statuses)); } - List selectListByPage(@Param("title") String title, - @Param("activityType") Integer activityType, - @Param("statuses") Collection statuses, - @Param("offset") Integer offset, - @Param("limit") Integer limit); - - Integer selectCountByPage(@Param("title") String title, - @Param("activityType") Integer activityType, - @Param("statuses") Collection statuses); + default IPage selectPage(PromotionActivityPageReqDTO pageReqDTO) { + return selectPage(new Page<>(pageReqDTO.getPageNo(), pageReqDTO.getPageSize()), + new QueryWrapperX().likeIfPresent("title", pageReqDTO.getTitle()) + .eqIfPresent("activity_type", pageReqDTO.getActivityType()) + .inIfPresent("status", pageReqDTO.getStatuses())); + } default List selectList(PromotionActivityListReqDTO listReqDTO) { return selectList(new QueryWrapperX().inIfPresent("id", listReqDTO.getActiveIds())); diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/activity/PromotionActivityManager.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/activity/PromotionActivityManager.java index ec016a31..34dbd6ee 100644 --- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/activity/PromotionActivityManager.java +++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/manager/activity/PromotionActivityManager.java @@ -1,6 +1,8 @@ package cn.iocoder.mall.promotionservice.manager.activity; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityListReqDTO; +import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO; import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; import cn.iocoder.mall.promotionservice.service.activity.PromotionActivityService; import org.springframework.beans.factory.annotation.Autowired; @@ -23,4 +25,8 @@ public class PromotionActivityManager { return promotionActivityService.listPromotionActivities(listReqDTO); } + public PageResult pagePromotionActivity(PromotionActivityPageReqDTO pageReqDTO) { + return promotionActivityService.pagePromotionActivity(pageReqDTO); + } + } diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/activity/PromotionActivityRpcImpl.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/activity/PromotionActivityRpcImpl.java index 3103e905..7b05a0a4 100644 --- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/activity/PromotionActivityRpcImpl.java +++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/rpc/activity/PromotionActivityRpcImpl.java @@ -1,8 +1,10 @@ package cn.iocoder.mall.promotionservice.rpc.activity; import cn.iocoder.common.framework.vo.CommonResult; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.promotion.api.rpc.activity.PromotionActivityRpc; import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityListReqDTO; +import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO; import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; import cn.iocoder.mall.promotionservice.manager.activity.PromotionActivityManager; import org.apache.dubbo.config.annotation.DubboService; @@ -18,6 +20,11 @@ public class PromotionActivityRpcImpl implements PromotionActivityRpc { @Autowired private PromotionActivityManager promotionActivityManager; + @Override + public CommonResult> pagePromotionActivity(PromotionActivityPageReqDTO pageReqDTO) { + return success(promotionActivityManager.pagePromotionActivity(pageReqDTO)); + } + @Override public CommonResult> listPromotionActivities(PromotionActivityListReqDTO listReqDTO) { return success(promotionActivityManager.listPromotionActivities(listReqDTO)); diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/PromotionActivityService.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/PromotionActivityService.java index baab7260..7150c6b3 100644 --- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/PromotionActivityService.java +++ b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/PromotionActivityService.java @@ -1,13 +1,15 @@ package cn.iocoder.mall.promotionservice.service.activity; -import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityTypeEnum; +import cn.iocoder.common.framework.vo.PageResult; import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; +import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityTypeEnum; import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityListReqDTO; +import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityPageReqDTO; import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; import cn.iocoder.mall.promotionservice.convert.activity.PromotionActivityConvert; import cn.iocoder.mall.promotionservice.dal.mysql.dataobject.activity.PromotionActivityDO; import cn.iocoder.mall.promotionservice.dal.mysql.mapper.activity.PromotionActivityMapper; -import cn.iocoder.mall.promotionservice.service.activity.bo.PromotionActivityPageBO; +import com.baomidou.mybatisplus.core.metadata.IPage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.Assert; @@ -31,10 +33,6 @@ public class PromotionActivityService { return PromotionActivityConvert.INSTANCE.convertList(activityList); } - public List listPromotionActivitiesBySpuId(Integer spuId, Collection activityStatuses) { - return this.listPromotionActivitiesBySpuIds(Collections.singleton(spuId), activityStatuses); - } - public List listPromotionActivitiesBySpuIds(Collection spuIds, Collection activityStatuses) { if (spuIds.isEmpty() || activityStatuses.isEmpty()) { return Collections.emptyList(); @@ -72,16 +70,9 @@ public class PromotionActivityService { return PromotionActivityConvert.INSTANCE.convertList(activityList); } - public PromotionActivityPageBO getPromotionActivityPage(Integer pageNo,Integer pageSize,String title,Integer activityType,Collection statuses) { - PromotionActivityPageBO promotionActivityPageBO = new PromotionActivityPageBO(); - // 查询分页数据 - int offset = (pageNo - 1) * pageSize; - promotionActivityPageBO.setList(PromotionActivityConvert.INSTANCE.convertToRespDTO(promotionActivityMapper.selectListByPage( - title, activityType,statuses, offset, pageSize))); - // 查询分页总数 - promotionActivityPageBO.setTotal(promotionActivityMapper.selectCountByPage( - title,activityType,statuses)); - return promotionActivityPageBO; + public PageResult pagePromotionActivity(PromotionActivityPageReqDTO pageReqDTO) { + IPage promotionActivityPage = promotionActivityMapper.selectPage(pageReqDTO); + return PromotionActivityConvert.INSTANCE.convertPage(promotionActivityPage); } private boolean isSpuMatchTimeLimitDiscount(Integer spuId, PromotionActivityDO activity) { diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/bo/PromotionActivityBO.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/bo/PromotionActivityBO.java deleted file mode 100644 index 513a01c0..00000000 --- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/bo/PromotionActivityBO.java +++ /dev/null @@ -1,153 +0,0 @@ -package cn.iocoder.mall.promotionservice.service.activity.bo; - -import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityStatusEnum; -import cn.iocoder.mall.promotion.api.enums.activity.PromotionActivityTypeEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; -import java.util.List; - -@Data -@Accessors(chain = true) -public class PromotionActivityBO implements Serializable { - - /** - * 活动编号 - */ - private Integer id; - /** - * 活动标题 - */ - private String title; - /** - * 活动类型 - * - * 参见 {@link PromotionActivityTypeEnum} 枚举 - */ - private Integer activityType; - /** - * 活动状态 - * - * 参见 {@link PromotionActivityStatusEnum} 枚举 - */ - private Integer status; - /** - * 开始时间 - */ - private Date startTime; - /** - * 结束时间 - */ - private Date endTime; - /** - * 限制折扣 - */ - private TimeLimitedDiscount timeLimitedDiscount; - /** - * 满减送 - */ - private FullPrivilege fullPrivilege; - - /** - * 限时折扣 - */ - @Data - @Accessors(chain = true) - public static class TimeLimitedDiscount implements Serializable { - - /** - * 商品折扣 - */ - @Data - @Accessors(chain = true) - public static class Item implements Serializable { - - /** - * 商品 SPU 编号 - */ - private Integer spuId; - /** - * 优惠类型 - */ - private Integer preferentialType; - /** - * 优惠值 - */ - private Integer preferentialValue; - - } - - /** - * 每人每种限购多少 - * - * 当 quota = 0 时,表示不限购 - */ - private Integer quota; - /** - * 商品折扣数组 - */ - private List items; - - } - - /** - * 满减送 - */ - @Data - @Accessors(chain = true) - public static class FullPrivilege implements Serializable { - - /** - * 优惠 - */ - @Data - @Accessors(chain = true) - public static class Privilege implements Serializable { - - /** - * 满足类型 - * - * 1 - 金额 - * 2 - 件数 - */ - private Integer meetType; - /** - * 满足值 - */ - private Integer meetValue; - /** - * 优惠类型 - */ - private Integer preferentialType; - /** - * 优惠值 - */ - private Integer preferentialValue; - - } - - /** - * 可用范围的类型 - * - * 参见 {@link cn.iocoder.mall.promotion.api.enums.RangeTypeEnum} 枚举 - * 暂时只用 “所有可用” + “PRODUCT_INCLUDE_PRT” - */ - private Integer rangeType; - /** - * 指定可用商品列表 - */ - private List rangeValues; - /** - * 是否循环 - */ - private Boolean cycled; - /** - * 优惠数组 - */ - private List privileges; - - } - -} diff --git a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/bo/PromotionActivityPageBO.java b/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/bo/PromotionActivityPageBO.java deleted file mode 100644 index bbaeac8a..00000000 --- a/promotion-service-project/promotion-service-app/src/main/java/cn/iocoder/mall/promotionservice/service/activity/bo/PromotionActivityPageBO.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.iocoder.mall.promotionservice.service.activity.bo; - -import cn.iocoder.mall.promotion.api.rpc.activity.dto.PromotionActivityRespDTO; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.List; - -/** - * 促销活动分页 BO - */ -@Data -@Accessors(chain = true) -public class PromotionActivityPageBO { - - /** - * PromotionActivityBO 数组 - */ - private List list; - /** - * 总量 - */ - private Integer total; - -} diff --git a/promotion/promotion-service-impl/pom.xml b/promotion/promotion-service-impl/pom.xml deleted file mode 100644 index 7156cbe5..00000000 --- a/promotion/promotion-service-impl/pom.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - promotion - cn.iocoder.mall - 1.0-SNAPSHOT - - 4.0.0 - - promotion-service-impl - - - - - cn.iocoder.mall - promotion-service-api - 1.0-SNAPSHOT - - - cn.iocoder.mall - system-service-api - 1.0-SNAPSHOT - - - cn.iocoder.mall - product-rpc-api - 1.0-SNAPSHOT - - - - - mysql - mysql-connector-java - - - - org.springframework - spring-tx - - - org.springframework - spring-jdbc - - - - com.alibaba - druid-spring-boot-starter - - - - com.baomidou - mybatis-plus-boot-starter - - - - - com.alibaba.cloud - spring-cloud-starter-dubbo - - - - - com.alibaba.cloud - spring-cloud-starter-alibaba-nacos-discovery - - - - - com.alibaba.cloud - spring-cloud-alibaba-seata - - - - - com.xuxueli - xxl-job-core - - - - - com.google.guava - guava - - - - - org.springframework.boot - spring-boot-starter-test - test - - - cn.iocoder.mall - mall-spring-boot-starter-mybatis - 1.0-SNAPSHOT - compile - - - cn.iocoder.mall - mall-spring-boot-starter-mybatis - 1.0-SNAPSHOT - compile - - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - - - diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/convert/PromotionActivityConvert.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/convert/PromotionActivityConvert.java deleted file mode 100644 index b3141ce8..00000000 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/convert/PromotionActivityConvert.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.mall.promotion.biz.convert; - -import cn.iocoder.mall.promotion.api.bo.PromotionActivityBO; -import cn.iocoder.mall.promotion.biz.dataobject.PromotionActivityDO; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -@Mapper -public interface PromotionActivityConvert { - - PromotionActivityConvert INSTANCE = Mappers.getMapper(PromotionActivityConvert.class); - - @Mappings({}) - PromotionActivityBO convertToBO(PromotionActivityDO activity); - - @Mappings({}) - List convertToBO(List activityList); - -// @Mappings({}) -// PromotionActivityDO convert(PromotionActivityAddDTO activityAddDTO); -// -// @Mappings({}) -// PromotionActivityDO convert(PromotionActivityUpdateDTO activityUpdateDTO); - -} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dao/PromotionActivityMapper.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dao/PromotionActivityMapper.java deleted file mode 100644 index fd5ba7fd..00000000 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dao/PromotionActivityMapper.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.mall.promotion.biz.dao; - -import cn.iocoder.mall.promotion.biz.dataobject.PromotionActivityDO; -import org.apache.ibatis.annotations.Param; -import org.springframework.stereotype.Repository; - -import java.util.Collection; -import java.util.List; - -@Repository -public interface PromotionActivityMapper { - - PromotionActivityDO selectById(@Param("id") Integer id); - - List selectListByStatus(@Param("statuses") Collection statuses); - - void insert(PromotionActivityDO activity); - - List selectListByPage(@Param("title") String title, - @Param("activityType") Integer activityType, - @Param("statuses") Collection statuses, - @Param("offset") Integer offset, - @Param("limit") Integer limit); - - Integer selectCountByPage(@Param("title") String title, - @Param("activityType") Integer activityType, - @Param("statuses") Collection statuses); - -} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java deleted file mode 100644 index a5189384..00000000 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/BannerDO.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.iocoder.mall.promotion.biz.dataobject; - -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * Banner 广告页 - */ -@Data -@Accessors(chain = true) -public class BannerDO extends DeletableDO { - - /** - * 编号 - */ - private Integer id; - /** - * 标题 - */ - private String title; - /** - * 跳转链接 - */ - private String url; - /** - * 图片链接 - */ - private String picUrl; - /** - * 排序 - */ - private Integer sort; - /** - * 状态 - * - * {@link cn.iocoder.common.framework.enums.CommonStatusEnum} - */ - private Integer status; - /** - * 备注 - */ - private String memo; - - // TODO 芋艿 点击次数。&& 其他数据相关 - -} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java deleted file mode 100644 index be5e47e8..00000000 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/dataobject/ProductRecommendDO.java +++ /dev/null @@ -1,46 +0,0 @@ -package cn.iocoder.mall.promotion.biz.dataobject; - - -import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; -import cn.iocoder.mall.promotion.api.enums.ProductRecommendTypeEnum; -import lombok.Data; -import lombok.experimental.Accessors; - -/** - * 商品推荐 DO - */ -@Data -@Accessors(chain = true) -public class ProductRecommendDO extends DeletableDO { - - /** - * 编号 - */ - private Integer id; - /** - * 类型 - * - * {@link ProductRecommendTypeEnum} - */ - private Integer type; - /** - * 商品 Spu 编号 - */ - private Integer productSpuId; - // TODO 芋艿,商品 spu 名 - /** - * 排序 - */ - private Integer sort; - /** - * 状态 - * - * {@link cn.iocoder.common.framework.enums.CommonStatusEnum} - */ - private Integer status; - /** - * 备注 - */ - private String memo; - -} diff --git a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/PromotionActivityServiceImpl.java b/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/PromotionActivityServiceImpl.java deleted file mode 100644 index 487a3f1e..00000000 --- a/promotion/promotion-service-impl/src/main/java/cn/iocoder/mall/promotion/biz/service/PromotionActivityServiceImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -package cn.iocoder.mall.promotion.biz.service; - -import cn.iocoder.mall.promotion.api.PromotionActivityService; -import cn.iocoder.mall.promotion.api.bo.PromotionActivityBO; -import cn.iocoder.mall.promotion.api.bo.PromotionActivityPageBO; -import cn.iocoder.mall.promotion.api.enums.PromotionActivityTypeEnum; -import cn.iocoder.mall.promotion.api.enums.RangeTypeEnum; -import cn.iocoder.mall.promotion.api.dto.PromotionActivityPageDTO; -import cn.iocoder.mall.promotion.biz.convert.PromotionActivityConvert; -import cn.iocoder.mall.promotion.biz.dao.PromotionActivityMapper; -import cn.iocoder.mall.promotion.biz.dataobject.PromotionActivityDO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.util.Assert; - -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -@Service // 实际上不用添加。添加的原因是,必须 Spring 报错提示 -@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.PromotionActivityService.version}") -public class PromotionActivityServiceImpl implements PromotionActivityService { - - @Autowired - private PromotionActivityMapper promotionActivityMapper; - - @Override - public List getPromotionActivityListBySpuId(Integer spuId, Collection activityStatuses) { - return this.getPromotionActivityListBySpuIds(Collections.singleton(spuId), activityStatuses); - } - - @Override - public List getPromotionActivityListBySpuIds(Collection spuIds, Collection activityStatuses) { - if (spuIds.isEmpty() || activityStatuses.isEmpty()) { - return Collections.emptyList(); - } - // 查询指定状态的促销活动 - List activityList = promotionActivityMapper.selectListByStatus(activityStatuses); - if (activityList.isEmpty()) { - return Collections.emptyList(); - } - // 匹配商品 - for (Iterator iterator = activityList.iterator(); iterator.hasNext();) { - PromotionActivityDO activity = iterator.next(); - boolean matched = false; - for (Integer spuId : spuIds) { - if (PromotionActivityTypeEnum.TIME_LIMITED_DISCOUNT.getValue().equals(activity.getActivityType())) { - matched = isSpuMatchTimeLimitDiscount(spuId, activity); - } else if (PromotionActivityTypeEnum.FULL_PRIVILEGE.getValue().equals(activity.getActivityType())) { - matched = isSpuMatchFullPrivilege(spuId, activity); - } - if (matched) { - break; - } - } - // 不匹配,则进行移除 - if (!matched) { - iterator.remove(); - } else { // 匹配,则做一些后续的处理 - // 如果是限时折扣,移除不在 spuId 数组中的折扣规则 - if (PromotionActivityTypeEnum.TIME_LIMITED_DISCOUNT.getValue().equals(activity.getActivityType())) { - activity.getTimeLimitedDiscount().getItems().removeIf(item -> !spuIds.contains(item.getSpuId())); - } - } - } - // 返回最终结果 - return PromotionActivityConvert.INSTANCE.convertToBO(activityList); - } - - @Override - public PromotionActivityPageBO getPromotionActivityPage(PromotionActivityPageDTO promotionActivityPageDTO) { - PromotionActivityPageBO promotionActivityPageBO = new PromotionActivityPageBO(); - // 查询分页数据 - int offset = (promotionActivityPageDTO.getPageNo() - 1) * promotionActivityPageDTO.getPageSize(); - promotionActivityPageBO.setList(PromotionActivityConvert.INSTANCE.convertToBO(promotionActivityMapper.selectListByPage( - promotionActivityPageDTO.getTitle(), promotionActivityPageDTO.getActivityType(), - promotionActivityPageDTO.getStatuses(), - offset, promotionActivityPageDTO.getPageSize()))); - // 查询分页总数 - promotionActivityPageBO.setTotal(promotionActivityMapper.selectCountByPage( - promotionActivityPageDTO.getTitle(), promotionActivityPageDTO.getActivityType(), - promotionActivityPageDTO.getStatuses())); - return promotionActivityPageBO; - } - - private boolean isSpuMatchTimeLimitDiscount(Integer spuId, PromotionActivityDO activity) { - Assert.isTrue(PromotionActivityTypeEnum.TIME_LIMITED_DISCOUNT.getValue().equals(activity.getActivityType()), - "传入的必须的促销活动必须是限时折扣"); - return activity.getTimeLimitedDiscount().getItems().stream() - .anyMatch(item -> spuId.equals(item.getSpuId())); - } - - private boolean isSpuMatchFullPrivilege(Integer spuId, PromotionActivityDO activity) { - Assert.isTrue(PromotionActivityTypeEnum.FULL_PRIVILEGE.getValue().equals(activity.getActivityType()), - "传入的必须的促销活动必须是满减送"); - PromotionActivityDO.FullPrivilege fullPrivilege = activity.getFullPrivilege(); - if (RangeTypeEnum.ALL.getValue().equals(fullPrivilege.getRangeType())) { - return true; - } else if (RangeTypeEnum.PRODUCT_INCLUDE_PART.getValue().equals(fullPrivilege.getRangeType())) { - return fullPrivilege.getRangeValues().contains(spuId); - } else { - throw new IllegalArgumentException(String.format("促销活动(%s) 可用范围的类型是不正确", activity.toString())); - } - } - -} diff --git a/promotion/promotion-service-impl/src/main/resources/mapper/PromotionActivityMapper.xml b/promotion/promotion-service-impl/src/main/resources/mapper/PromotionActivityMapper.xml deleted file mode 100644 index 4aa07e33..00000000 --- a/promotion/promotion-service-impl/src/main/resources/mapper/PromotionActivityMapper.xml +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - id, title, activity_type, status, start_time, - end_time, invalid_time, delete_time, time_limited_discount, full_privilege, - create_time, update_time - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - INSERT INTO promotion_activity ( - title, activity_type, status, start_time, - end_time, invalid_time, delete_time, - time_limited_discount, - full_privilege, - create_time - ) VALUES ( - #{title}, #{activityType}, #{status}, #{startTime}, - #{endTime}, #{invalidTime}, #{deleteTime}, - #{timeLimitedDiscount, typeHandler=cn.iocoder.common.framework.mybatis.JSONTypeHandler}, - #{fullPrivilege, typeHandler=cn.iocoder.common.framework.mybatis.JSONTypeHandler}, - #{createTime} - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsPromotionActivityController.java b/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsPromotionActivityController.java deleted file mode 100644 index 3a90b369..00000000 --- a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/controller/admins/AdminsPromotionActivityController.java +++ /dev/null @@ -1,58 +0,0 @@ -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.enums.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 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)); - } - -} diff --git a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsBannerPageVO.java b/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsBannerPageVO.java deleted file mode 100644 index 94711cfd..00000000 --- a/promotion/promotion-start/src/main/java/cn/iocoder/mall/promotion/application/vo/admins/AdminsBannerPageVO.java +++ /dev/null @@ -1,20 +0,0 @@ -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 list; - @ApiModelProperty(value = "Banner 总数") - private Integer total; - -} diff --git a/promotion/promotion-start/src/main/resources/application-test.yaml b/promotion/promotion-start/src/main/resources/application-test.yaml deleted file mode 100644 index 96b1b556..00000000 --- a/promotion/promotion-start/src/main/resources/application-test.yaml +++ /dev/null @@ -1,6 +0,0 @@ -swagger: - enable: false - title: 营销子系统 - description: 营销子系统 - version: 1.0.0 - base-package: cn.iocoder.mall.promotion.application.controller diff --git a/promotion/promotion-start/src/main/resources/application.yaml b/promotion/promotion-start/src/main/resources/application.yaml deleted file mode 100644 index b00b3e56..00000000 --- a/promotion/promotion-start/src/main/resources/application.yaml +++ /dev/null @@ -1,33 +0,0 @@ -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