forked from YunaiV/yudao-cloud
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
wuwenbin
committed
Jul 26, 2020
1 parent
ac5ab0b
commit 67f8b61
Showing
24 changed files
with
1,219 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...rvice-app/src/main/java/cn/iocoder/mall/promotionservice/PromotionServiceApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package cn.iocoder.mall.promotionservice; | ||
|
||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class PromotionServiceApplication { | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(PromotionServiceApplication.class, args); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...service-app/src/main/java/cn/iocoder/mall/promotionservice/config/AsyncConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package cn.iocoder.mall.promotionservice.config; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.annotation.EnableAsync; | ||
|
||
@Configuration | ||
@EnableAsync(proxyTargetClass = true) // 开启 Spring Async 异步的功能 | ||
public class AsyncConfiguration { | ||
} |
28 changes: 28 additions & 0 deletions
28
...vice-app/src/main/java/cn/iocoder/mall/promotionservice/config/DatabaseConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package cn.iocoder.mall.promotionservice.config; | ||
|
||
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector; | ||
import com.baomidou.mybatisplus.core.injector.ISqlInjector; | ||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; | ||
import org.mybatis.spring.annotation.MapperScan; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.transaction.annotation.EnableTransactionManagement; | ||
|
||
@Configuration | ||
@MapperScan("cn.iocoder.mall.promotionservice.dal.mysql.mapper") // 扫描对应的 Mapper 接口 | ||
@EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理。 | ||
public class DatabaseConfiguration { | ||
|
||
// 数据库连接池 Druid | ||
|
||
@Bean | ||
public ISqlInjector sqlInjector() { | ||
return new DefaultSqlInjector(); // MyBatis Plus 逻辑删除 | ||
} | ||
|
||
@Bean | ||
public PaginationInterceptor paginationInterceptor() { | ||
return new PaginationInterceptor(); // MyBatis Plus 分页插件 | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
...main/java/cn/iocoder/mall/promotionservice/convert/activity/PromotionActivityConvert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cn.iocoder.mall.promotionservice.convert.activity; | ||
|
||
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 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<PromotionActivityBO> convertToBO(List<PromotionActivityDO> activityList); | ||
|
||
@Mappings({}) | ||
List<PromotionActivityDO> convertToDO(List<PromotionActivityBO> activityList); | ||
|
||
@Mappings({}) | ||
List<PromotionActivityRespDTO> convertToRespDTO(List<PromotionActivityDO> activityList); | ||
|
||
// @Mappings({}) | ||
// PromotionActivityDO convert(PromotionActivityAddDTO activityAddDTO); | ||
// | ||
// @Mappings({}) | ||
// PromotionActivityDO convert(PromotionActivityUpdateDTO activityUpdateDTO); | ||
|
||
} |
188 changes: 188 additions & 0 deletions
188
...a/cn/iocoder/mall/promotionservice/dal/mysql/dataobject/activity/PromotionActivityDO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
package cn.iocoder.mall.promotionservice.dal.mysql.dataobject.activity; | ||
|
||
import cn.iocoder.mall.mybatis.core.dataobject.BaseDO; | ||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO; | ||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
|
||
/** | ||
* 促销活动 DO | ||
*/ | ||
@Data | ||
@Accessors(chain = true) | ||
public class PromotionActivityDO extends DeletableDO { | ||
|
||
/** | ||
* 活动编号 | ||
*/ | ||
private Integer id; | ||
/** | ||
* 活动标题 | ||
*/ | ||
private String title; | ||
/** | ||
* 活动类型 | ||
* | ||
* 参见 {@link cn.iocoder.mall.promotion.api.enums.PromotionActivityTypeEnum} 枚举 | ||
*/ | ||
private Integer activityType; | ||
// /** | ||
// * 促销类型 | ||
// * // TODO 芋艿 https://jos.jd.com/api/complexTemplate.htm?webPamer=promotion_v_o&groupName=%E4%BF%83%E9%94%80API&id=54&restName=jingdong.seller.promotion.list&isMulti=false 促销类型,可选值:单品促销(1),赠品促销(4),套装促销(6),总价促销(10) | ||
// */ | ||
// private Integer promotionType; | ||
/** | ||
* 活动状态 | ||
* | ||
* 参见 {@link cn.iocoder.mall.promotion.api.enums.PromotionActivityStatusEnum} 枚举 | ||
*/ | ||
private Integer status; | ||
/** | ||
* 开始时间 | ||
*/ | ||
private Date startTime; | ||
/** | ||
* 结束时间 | ||
*/ | ||
private Date endTime; | ||
/** | ||
* 失效时间 | ||
*/ | ||
private Date invalidTime; | ||
/** | ||
* 删除时间 | ||
*/ | ||
private Date deleteTime; | ||
/** | ||
* 限制折扣字符串,使用 JSON 序列化成字符串存储 | ||
*/ | ||
private TimeLimitedDiscount timeLimitedDiscount; | ||
/** | ||
* 满减送字符串,使用 JSON 序列化成字符串存储 | ||
*/ | ||
private FullPrivilege fullPrivilege; | ||
|
||
/** | ||
* 限制折扣 | ||
*/ | ||
@Data | ||
@Accessors(chain = true) | ||
public static class TimeLimitedDiscount { | ||
|
||
/** | ||
* 商品折扣 | ||
*/ | ||
@Data | ||
@Accessors(chain = true) | ||
public static class Item { | ||
|
||
/** | ||
* 商品 SPU 编号 | ||
*/ | ||
private Integer spuId; | ||
/** | ||
* 优惠类型 | ||
*/ | ||
private Integer preferentialType; | ||
/** | ||
* 优惠值 | ||
*/ | ||
private Integer preferentialValue; | ||
|
||
} | ||
|
||
/** | ||
* 每人每种限购多少 | ||
* | ||
* 当 quota = 0 时,表示不限购 | ||
*/ | ||
private Integer quota; | ||
/** | ||
* 商品折扣数组 | ||
*/ | ||
private List<Item> items; | ||
|
||
} | ||
|
||
/** | ||
* 满减送 | ||
*/ | ||
@Data | ||
@Accessors(chain = true) | ||
public static class FullPrivilege { | ||
|
||
/** | ||
* 优惠 | ||
*/ | ||
@Data | ||
@Accessors(chain = true) | ||
public static class Privilege { | ||
|
||
/** | ||
* 满足类型 | ||
* | ||
* 1 - 金额 | ||
* 2 - 件数 | ||
*/ | ||
private Integer meetType; | ||
/** | ||
* 满足值 | ||
*/ | ||
private Integer meetValue; | ||
/** | ||
* 优惠类型 | ||
*/ | ||
private Integer preferentialType; | ||
/** | ||
* 优惠值 | ||
*/ | ||
private Integer preferentialValue; | ||
// /** | ||
// * 是否包邮 | ||
// */ | ||
// private Boolean isPostage; | ||
// /** | ||
// * 积分 | ||
// */ | ||
// private Integer score; | ||
// /** | ||
// * 优惠劵(码)分组编号 | ||
// */ | ||
// private Integer couponTemplateId; | ||
// /** | ||
// * 优惠劵(码)数量 | ||
// */ | ||
// private Integer couponNum; | ||
// /** | ||
// * 赠品编号 | ||
// */ | ||
// private Integer presentId; | ||
|
||
} | ||
|
||
/** | ||
* 可用范围的类型 | ||
* | ||
* 参见 {@link cn.iocoder.mall.promotion.api.enums.RangeTypeEnum} 枚举 | ||
* 暂时只用 “所有可用” + “PRODUCT_INCLUDE_PRT” | ||
*/ | ||
private Integer rangeType; | ||
/** | ||
* 指定可用商品列表 | ||
*/ | ||
private List<Integer> rangeValues; | ||
/** | ||
* 是否循环 | ||
*/ | ||
private Boolean cycled; | ||
/** | ||
* 优惠数组 | ||
*/ | ||
private List<Privilege> privileges; | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.