Skip to content

Commit

Permalink
fix promotion优惠券工程继续迁移,未完成,再提交下
Browse files Browse the repository at this point in the history
  • Loading branch information
wuwenbin committed Jul 26, 2020
1 parent ac5ab0b commit 67f8b61
Show file tree
Hide file tree
Showing 24 changed files with 1,219 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.Collection;
import java.util.List;

public interface PromotionActivityService {
public interface PromotionActivityRpc {

List<PromotionActivityRespDTO> getPromotionActivityListBySpuId(Integer spuId,
Collection<Integer> activityStatuses);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import java.util.List;

public interface BannerService {
public interface BannerRpc {

List<BannerRespDTO> getBannerListByStatus(Integer status);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import javax.validation.constraints.NotNull;
import java.util.List;

public interface CouponService {
public interface CouponRpc {

// ========== 优惠劵(码)模板 ==========

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cn.iocoder.mall.promotion.api.rpc.coupon.dto;

import cn.iocoder.mall.promotion.api.rpc.coupon.CouponService;
import cn.iocoder.mall.promotion.api.rpc.coupon.CouponRpc;
import lombok.Data;
import lombok.experimental.Accessors;

Expand All @@ -10,7 +10,7 @@
/**
* 优惠劵商品 DTO
*
* 主要用于 {@link CouponService#getCouponCardList(Integer, List)}
* 主要用于 {@link CouponRpc#getCouponCardList(Integer, List)}
*/
@Data
@Accessors(chain = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import java.util.List;

public interface ProductRecommendService {
public interface ProductRecommendRpc {

List<ProductRecommendRespDTO> getProductRecommendList(Integer type, Integer status);

Expand Down
30 changes: 30 additions & 0 deletions promotion-service-project/promotion-service-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,40 @@
<artifactId>promotion-service-app</artifactId>

<dependencies>

<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>mall-spring-boot-starter-dubbo</artifactId>
</dependency>

<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>promotion-service-api</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>

<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
</dependency>

<dependency>
<groupId>cn.iocoder.mall</groupId>
<artifactId>mall-spring-boot-starter-mybatis</artifactId>
</dependency>
</dependencies>

</project>
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);
}

}
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 {
}
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 分页插件
}

}
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);

}
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;

}

}
Loading

0 comments on commit 67f8b61

Please sign in to comment.