Merge remote-tracking branch 'origin/master-v2'
| | |
| | | <springfox-swagger.version>2.9.2</springfox-swagger.version> |
| | | <io.swagger.version>1.5.22</io.swagger.version> |
| | | <base.version>1.0-SNAPSHOT</base.version> |
| | | <mybatis-plus.version>3.4.1</mybatis-plus.version> |
| | | </properties> |
| | | |
| | | <dependencies> |
| | |
| | | <dependency> |
| | | <groupId>org.projectlombok</groupId> |
| | | <artifactId>lombok</artifactId> |
| | | <version>1.18.20</version> |
| | | <scope>provided</scope> |
| | | <optional>true</optional> |
| | | </dependency> |
| | | |
| | |
| | | <artifactId>aspectjweaver</artifactId> |
| | | <version>1.9.7</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.redisson</groupId> |
| | | <artifactId>redisson</artifactId> |
| | | <version>3.15.6</version> <!-- 确保使用与你的 Spring Boot 版本兼容的 Redisson 版本 --> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
对比新文件 |
| | |
| | | package com.mzl.flower.config; |
| | | |
| | | import org.redisson.Redisson; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.redisson.config.Config; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class RedissonConfig { |
| | | |
| | | @Value("${spring.redis.host}") |
| | | private String host; |
| | | |
| | | @Value("${spring.redis.port}") |
| | | private Integer port; |
| | | |
| | | @Value("${spring.redis.password}") |
| | | private String password; |
| | | |
| | | @Value("${spring.redis.timeout:10000}") |
| | | private int timeout; // 10秒 |
| | | |
| | | @Value("${spring.redis.connectionPoolSize:100}") |
| | | private int connectionPoolSize; // 100个连接 |
| | | |
| | | @Value("${spring.redis.connectionMinimumIdleSize:20}") |
| | | private int connectionMinimumIdleSize; // 20个空闲连接 |
| | | |
| | | |
| | | |
| | | @Bean(destroyMethod = "shutdown") |
| | | public RedissonClient redissonClient() { |
| | | Config config = new Config(); |
| | | config.useSingleServer() |
| | | .setAddress(String.format("redis://%s:%d", host, port)) |
| | | .setPassword(password) |
| | | .setTimeout(timeout) |
| | | .setConnectionPoolSize(connectionPoolSize) |
| | | .setConnectionMinimumIdleSize(connectionMinimumIdleSize); |
| | | |
| | | return Redisson.create(config); |
| | | } |
| | | } |
| | |
| | | .antMatchers("/api/customer/flower/list/view").permitAll() |
| | | .antMatchers("/api/customer/flower/up/stock").permitAll() |
| | | .antMatchers("api/pub/customer/home/**").permitAll() |
| | | .antMatchers("/api/customer/point/goods/**").permitAll() |
| | | .antMatchers("/api/upload/oss/file").permitAll() |
| | | .antMatchers("/api/flower/zone/list").permitAll() |
| | | .antMatchers("/api/config/content/list/view").permitAll() |
| | | .antMatchers("/api/v2/coupon/home/alert").permitAll() |
| | | .antMatchers("/api/customer/partner/name").permitAll() |
| | | .antMatchers("/api/v2/coupon/app/home/alert").permitAll() |
| | | .antMatchers("/api/**").authenticated();//配置访问控制,必须认证过后才可以访问 |
| | | |
| | | } |
| | |
| | | |
| | | public static final String DEFAULT_PASSWORD = "1234562"; |
| | | |
| | | public static final String DEFAULT_MEMBER_ID = "1"; //默认会员等级 |
| | | |
| | | |
| | | /** |
| | | * 审核结果 |
| | |
| | | } |
| | | } |
| | | |
| | | public enum POINT_GOODS_STATUS { |
| | | A("上架"), |
| | | I("下架"); |
| | | |
| | | POINT_GOODS_STATUS(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | private String desc; |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | public enum POINT_GOOD_STATUS { |
| | | up("上架"), |
| | | off("下架"); |
| | | |
| | | POINT_GOOD_STATUS(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | private String desc; |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | public enum POINT_CHANGE_TYPE { |
| | | add("增加"), |
| | | reduce("减少"); |
| | | |
| | | POINT_CHANGE_TYPE(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | private String desc; |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | |
| | | public enum POINT_TYPE { |
| | | consume("消费获取"), |
| | | activity("活动获取"), |
| | | giveaway("积分赠送"), |
| | | sign("签到"), |
| | | deduction("积分扣减"), |
| | | exchange("积分兑换"), |
| | | expired("积分过期"); |
| | | |
| | | POINT_TYPE(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | private String desc; |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | public enum POINT_GOODS_RECORD_STATUS { |
| | | A("未使用"), |
| | | U("已使用"), |
| | | E("已过期"); |
| | | |
| | | POINT_GOODS_RECORD_STATUS(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | private String desc; |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | public enum DISCOUNT_TYPE { |
| | | ratio("百分比"), |
| | | amount("固定金额"); |
| | | |
| | | DISCOUNT_TYPE(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | private String desc; |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | public enum GROWTH_SOURCE { |
| | | sign("签到"), consume("消费"), downgrading("降级"); |
| | | |
| | | GROWTH_SOURCE(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | private String desc; |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | |
| | | public enum GROWTH_TYPE { |
| | | add("新增"), reduce("扣除"); |
| | | |
| | | GROWTH_TYPE(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | |
| | | private String desc; |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | } |
| | | public enum after_sale_type { |
| | | barters("换货"), |
| | | returns("退货"), |
| | | quality("1.质量问题"), |
| | | stockout("2.缺货问题"), |
| | | broken("3.断头问题"), |
| | | category("4.品类不符"), |
| | | grade("5.等级不符"), |
| | | ; |
| | | |
| | | after_sale_type(String desc) { |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | @ApiModel("优惠券批量操作") |
| | | @Data |
| | | public class BatchCouponTemplateDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "ID列表不能为空") |
| | | @NotNull(message = "ID列表不能为空") |
| | | private List<String> idList; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private String updateBy; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | |
| | | @Data |
| | | public class CreateCouponRecordAppDTO { |
| | | |
| | | /** |
| | | * 优惠券ID |
| | | */ |
| | | @ApiModelProperty(value = "优惠券ID") |
| | | @NotEmpty(message = "优惠券ID不能为空") |
| | | private String couponId; |
| | | |
| | | @ApiModelProperty(value = "商户ID",hidden = true) |
| | | private Long customerId; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class CreateCouponRecordDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券ID |
| | | */ |
| | | @ApiModelProperty(value = "优惠券ID") |
| | | @NotEmpty(message = "优惠券ID不能为空") |
| | | private String couponId; |
| | | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | // @NotEmpty(message = "用户id不能为空") |
| | | private String userId; |
| | | |
| | | /** |
| | | * 商户ID |
| | | */ |
| | | @ApiModelProperty(value = "商户ID") |
| | | @NotNull(message = "商户ID不能为空") |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * 状态(coupon_record_status)未使用、已使用、已过期 |
| | | */ |
| | | // @ApiModelProperty(value = "状态") |
| | | // private String status; |
| | | |
| | | /** |
| | | * 有效开始时间 |
| | | */ |
| | | // @ApiModelProperty(value = "有效开始时间") |
| | | // @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | // @DateTimeFormat |
| | | // @NotNull(message = "有效开始时间不能为空") |
| | | // private LocalDateTime effectiveStart; |
| | | |
| | | /** |
| | | * 有效结束时间 |
| | | */ |
| | | // @ApiModelProperty(value = "有效结束时间") |
| | | // @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | // @DateTimeFormat |
| | | // @NotNull(message = "有效结束时间不能为空") |
| | | // private LocalDateTime effectiveEnd; |
| | | |
| | | /** |
| | | * 使用订单 |
| | | */ |
| | | // @ApiModelProperty(value = "订单号") |
| | | // private String orderId; |
| | | |
| | | /** |
| | | * 使用时间 |
| | | */ |
| | | // @ApiModelProperty(value = "使用时间") |
| | | // @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | // @DateTimeFormat |
| | | // private LocalDateTime usedTime; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CreateCouponTemplateActivyDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "couponName") |
| | | @NotEmpty(message = "优惠券名称不能为空") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE)") |
| | | @NotEmpty(message = "优惠券类型不能为空(COUPON_TYPE)") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | @NotEmpty(message = "领取渠道不能为空(COUPON_GET_TYPE)") |
| | | private String getType; |
| | | |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "使用规则") |
| | | @NotEmpty(message = "使用规则不能为空") |
| | | private String couponDescription; |
| | | |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | @NotNull(message = "领取开始时间不能为空") |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | @NotNull(message = "领取结束时间不能为空") |
| | | private LocalDateTime getEndDate; |
| | | |
| | | |
| | | /** |
| | | * 使用时间类型(COUPON_USAGE_TYPE)与领取时间一致、固定时间、领取后有效 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间类型(COUPON_USAGE_TYPE)") |
| | | @NotEmpty(message = "使用时间类型不能为空(COUPON_USAGE_TYPE)") |
| | | private String usageType; |
| | | |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型 (COUPON_USAGE_TIME_TYPE)") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | @Min(value = 1,message = "领取后有效时间必须大于等于1") |
| | | @Max(value = 99999999,message = "领取后有效时间不能超过99999999") |
| | | private Integer usageTimeNum; |
| | | |
| | | |
| | | /** |
| | | * 使用开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间-固定时间-开始日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间-固定时间-结束日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件,满多少钱") |
| | | @NotNull(message = "使用条件不能为空") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "发放数量") |
| | | @NotNull(message = "发放数量不能为空") |
| | | @Min(value = 1,message = "发放数量必须大于0") |
| | | @Max(value = 99999999,message = "库存数量不能超过99999999") |
| | | private Integer couponAmount; |
| | | |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | @ApiModelProperty(value = "每人限领") |
| | | @NotNull(message = "每人限领不能为空") |
| | | @Min(value = 1,message = "每人限领必须大于0") |
| | | @Max(value = 99999999,message = "每人限领不能超过99999999") |
| | | private Integer getLimit; |
| | | |
| | | /** |
| | | * 优惠券图片 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券图片") |
| | | private String imageUrl; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Data |
| | | public class CreateCouponTemplateBO { |
| | | |
| | | private String id; |
| | | |
| | | |
| | | /** |
| | | * 优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券) |
| | | */ |
| | | private String category; |
| | | /** |
| | | * 优惠券代码(唯一) |
| | | */ |
| | | private String couponCode; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 最大折扣金额(可选,仅对百分比折扣类型适用) |
| | | */ |
| | | private BigDecimal maxDiscountAmount; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | private LocalDateTime getEndDate; |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | private Integer getLimit; |
| | | |
| | | /** |
| | | * 使用时间类型(COUPON_USAGE_TIME_TYPE)与领取时间一致、固定时间、领取后有效 |
| | | */ |
| | | private String usageType; |
| | | |
| | | /** |
| | | * 使用次数限制 |
| | | */ |
| | | private Integer usageLimit; |
| | | |
| | | /** |
| | | * 每个用户的使用次数限制 |
| | | */ |
| | | private Integer usagePerUser; |
| | | |
| | | /** |
| | | * 使用开始时间 |
| | | */ |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | private Integer usageTimeNum; |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 兑换积分 |
| | | */ |
| | | private Integer point; |
| | | |
| | | /** |
| | | * 会员ID |
| | | */ |
| | | private Integer memberId; |
| | | |
| | | /** |
| | | * 指定的用户的id |
| | | */ |
| | | private List<Long> pointCostomIdList; |
| | | |
| | | /** |
| | | * 优惠券的图片 |
| | | */ |
| | | private String imageUrl; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CreateCouponTemplateDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "couponName") |
| | | @NotEmpty(message = "优惠券名称不能为空") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | @NotEmpty(message = "优惠券类型不能为空") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道") |
| | | @NotEmpty(message = "领取渠道不能为空") |
| | | private String getType; |
| | | |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "使用规则") |
| | | @NotEmpty(message = "使用规则不能为空") |
| | | private String couponDescription; |
| | | |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | @NotNull(message = "领取开始时间不能为空") |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | @NotNull(message = "领取结束时间不能为空") |
| | | private LocalDateTime getEndDate; |
| | | |
| | | |
| | | /** |
| | | * 使用时间类型(COUPON_USAGE_TIME_TYPE)与领取时间一致、固定时间、领取后有效 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间类型") |
| | | @NotEmpty(message = "使用时间类型不能为空") |
| | | private String usageType; |
| | | |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型 天、小时、分钟") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | private Integer usageTimeNum; |
| | | |
| | | |
| | | /** |
| | | * 使用开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间-固定时间-开始日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间-固定时间-结束日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件,满多少钱") |
| | | @NotNull(message = "使用条件不能为空") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "发放数量") |
| | | @NotNull(message = "发放数量不能为空") |
| | | private Integer couponAmount; |
| | | |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | @ApiModelProperty(value = "每人限领") |
| | | @NotNull(message = "每人限领不能为空") |
| | | private Integer getLimit; |
| | | |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * 积分优惠券 |
| | | */ |
| | | @Data |
| | | public class CreateCouponTemplatePointDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @NotEmpty(message = "优惠券名称不能为空") |
| | | private String couponName; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | @NotEmpty(message = "优惠券类型不能为空") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "使用规则") |
| | | @NotEmpty(message = "使用规则不能为空") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TYPE)天、小时、分钟") |
| | | @NotEmpty(message = "领取后有效类型不能为空") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value ="领取后有效时间整数,比如90(天,小时,分钟)" ) |
| | | @NotNull(message = "领取后有效时间不能为空") |
| | | @Min(value = 1,message = "领取后有效时间必须大于等于1") |
| | | @Max(value = 99999999,message = "领取后有效时间不能超过99999999") |
| | | private Integer usageTimeNum; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | @NotNull(message = "使用条件不能为空") |
| | | @Max(value = 99999999,message = "使用条件不能超过99999999") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | @Min(value = 1,message = "优惠券面值大于0") |
| | | @Max(value = 99999999,message = "优惠券面值不能超过99999999") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 库存 |
| | | */ |
| | | @ApiModelProperty(value = "库存") |
| | | @NotNull(message = "库存不能为空") |
| | | @Min(value = 1,message = "库存数量必须大于0") |
| | | @Max(value = 99999999,message = "库存数量不能超过99999999") |
| | | private Integer couponAmount; |
| | | |
| | | |
| | | @ApiModelProperty(value = "积分数量") |
| | | @NotNull(message = "积分数量不能为空") |
| | | @Min(value = 1,message = "积分数量必须大于0") |
| | | @Max(value = 99999999,message = "积分数量不能超过99999999") |
| | | private Integer point; |
| | | |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.Min; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class CreateCouponTemplateUserDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @NotEmpty(message = "优惠券名称不能为空") |
| | | private String couponName; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | @NotEmpty(message = "优惠券类型不能为空") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "使用规则") |
| | | @NotEmpty(message = "使用规则不能为空") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TYPE)天、小时、分钟") |
| | | @NotEmpty(message = "领取后有效类型不能为空") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value ="领取后有效时间整数,比如90(天,小时,分钟)" ) |
| | | @NotNull(message = "领取后有效时间不能为空") |
| | | @Min(value = 1,message = "领取后有效时间必须大于0") |
| | | @Max(value = 99999999,message = "领取后有效时间不能超过99999999") |
| | | private Integer usageTimeNum; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | @NotNull(message = "使用条件不能为空") |
| | | @Max(value = 99999999,message = "使用条件不能超过99999999") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | @Min(value = 1,message = "优惠券面值大于0") |
| | | @Max(value = 99999999,message = "优惠券面值不能超过99999999") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | |
| | | @ApiModelProperty(value = "指定的用户列表id") |
| | | @NotNull(message = "指定的用户列表id不能为空") |
| | | private List<Long> pointCostomIdList; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.Max; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class CreateCouponTemplateVipDTO { |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | @NotEmpty(message = "优惠券名称不能为空") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "使用规则") |
| | | @NotEmpty(message = "使用规则不能为空") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | @NotEmpty(message = "优惠券类型不能为空") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | @NotNull(message = "优惠券面值不能为空") |
| | | @Max(value = 99999999,message = "优惠券面值不能超过99999999") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | @NotNull(message = "使用条件不能为空") |
| | | @Max(value = 99999999,message = "使用条件不能超过99999999") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | | /** |
| | | * 会员等级 |
| | | */ |
| | | @ApiModelProperty(value = "会员等级") |
| | | @NotNull(message = "会员等级不能为空") |
| | | private Integer memberId; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TIME_TYPE)") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | @Max(value = 99999999,message = "领取后有效时间不能超过99999999") |
| | | private Integer usageTimeNum; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class ExchangeCouponDTO { |
| | | |
| | | @NotNull(message = "优惠券id不能为空") |
| | | private String couponId; |
| | | |
| | | @ApiModelProperty(value = "兑换数量",hidden = true) |
| | | private Integer num; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryActivePointCouponDTO{ |
| | | |
| | | @ApiModelProperty(value = "排序列 point desc / create_time desc,默认 create_time desc",hidden = true) |
| | | private String orderStr; |
| | | |
| | | @ApiModelProperty(value = "积分最小值") |
| | | private Integer minPoint; |
| | | |
| | | @ApiModelProperty(value = "积分最大值") |
| | | private Integer maxPoint; |
| | | |
| | | @ApiModelProperty(value = "优惠券种类",hidden = true) |
| | | private String category; |
| | | |
| | | @ApiModelProperty(value = "优惠券状态",hidden = true) |
| | | private String status; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TIME_TYPE)") |
| | | @DictTrans(target = "usageTimeTypeName",codeType = "COUPON_USAGE_TIME_TYPE") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | private Integer usageTimeNum; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | @ApiModel("App活动优惠券实体类") |
| | | public class QueryActivityEffectCouponDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE)" ,hidden = true) |
| | | private String couponDiscountType; |
| | | |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)",hidden = true) |
| | | private String getType; |
| | | |
| | | @ApiModelProperty(value = "领取用户类型(COUPON_GET_USER_TYPE)",hidden = true) |
| | | private String getUserType; |
| | | |
| | | @ApiModelProperty(value = "优惠券种类(COUPON_CATEGORY)",hidden = true) |
| | | private String category; |
| | | |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)",hidden = true) |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "领取人ID",hidden = true) |
| | | private String userId; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryCouponDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | private String couponDiscountType; |
| | | |
| | | @ApiModelProperty(value = "领取渠道") |
| | | private String getType; |
| | | |
| | | @ApiModelProperty(value = "领取用户类型") |
| | | private String getUserType; |
| | | |
| | | @ApiModelProperty(value = "优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券)") |
| | | private String category; |
| | | |
| | | @ApiModelProperty(value = "优惠券状态") |
| | | private String status; |
| | | |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryCouponRecordDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | private String couponDiscountType; |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNo; |
| | | |
| | | @ApiModelProperty(value = "用户id/店铺名称") |
| | | private String keyword; |
| | | |
| | | @ApiModelProperty(value = "联系方式") |
| | | private String tel; |
| | | |
| | | @ApiModelProperty(value = "领取渠道") |
| | | private String getType; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "领取用户类型-全部用户,指定用户") |
| | | private String getUserType; |
| | | |
| | | @ApiModelProperty(value = "优惠券模版ID") |
| | | private String couponId; |
| | | |
| | | @ApiModelProperty(value = "优惠券种类") |
| | | private String category; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryCouponStatisticsBO extends QueryCouponStatisticsDTO{ |
| | | |
| | | // @ApiModelProperty(value = "优惠券名称") |
| | | // private String name; |
| | | /** |
| | | * 优惠券总数 |
| | | */ |
| | | private String category; |
| | | |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryCouponStatisticsDTO { |
| | | |
| | | // @ApiModelProperty(value = "优惠券名称") |
| | | // private String name; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private String category; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryCouponVipDTO { |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "优惠券类型") |
| | | private String couponDiscountType; |
| | | |
| | | @ApiModelProperty(value = "id") |
| | | private String id; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class QueryExistCouponDTO { |
| | | |
| | | @ApiModelProperty(value = "商户ID") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty(value = "优惠券ID") |
| | | private String couponId; |
| | | |
| | | @ApiModelProperty(value = "优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券)") |
| | | private String category; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | @ApiModel("App活动优惠券实体类") |
| | | public class QueryMineCouponRecordDTO { |
| | | |
| | | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @ApiModelProperty(value = "用户id",hidden = true) |
| | | private String userId; |
| | | |
| | | /** |
| | | * 商户ID |
| | | */ |
| | | @ApiModelProperty(value = "商户ID",hidden = true) |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * 状态(coupon_record_status)未使用、已使用、已过期 |
| | | */ |
| | | @ApiModelProperty(value = "状态(coupon_record_status)",hidden = true) |
| | | private String status; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "描述") |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "限购数量") |
| | | private Integer limited; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.flower; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class FlowerLimitedDTO { |
| | | @ApiModelProperty(value = "ids") |
| | | private List<Long> ids; |
| | | |
| | | @ApiModelProperty(value = "限购数量") |
| | | private Integer limited; |
| | | } |
| | |
| | | @ApiModelProperty(value = "销量") |
| | | private Integer sales; |
| | | |
| | | @ApiModelProperty(value = "限购数量") |
| | | private Integer limited; |
| | | |
| | | @ApiModelProperty(value = "商品参数") |
| | | private List<ParamDTO> params; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.menber; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class MemberDTO { |
| | | @ApiModelProperty(value = "会员等级id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("会员等级名称") |
| | | @NotNull |
| | | private String name; |
| | | |
| | | @ApiModelProperty("成长点-区间-开始") |
| | | @NotNull |
| | | private int startPoint; |
| | | |
| | | @ApiModelProperty("成长点-区间-结束") |
| | | private Integer endPoint; |
| | | |
| | | @ApiModelProperty("会员折扣类型(百分比、固定金额)") |
| | | @NotNull |
| | | private String discountType; |
| | | |
| | | @ApiModelProperty("会员折扣百分比") |
| | | @NotNull |
| | | private BigDecimal discountRatio; |
| | | |
| | | @ApiModelProperty("会员折扣固定金额") |
| | | @NotNull |
| | | private BigDecimal discountAmount; |
| | | |
| | | @ApiModelProperty("消费金额(元)") |
| | | @NotNull |
| | | private int consumptionAmount; |
| | | |
| | | @ApiModelProperty("已消费产生的成长值") |
| | | @NotNull |
| | | private int growthValue; |
| | | |
| | | @ApiModelProperty("未消费产生的下降值") |
| | | @NotNull |
| | | private int downgradeValue; |
| | | |
| | | |
| | | @ApiModelProperty("背景") |
| | | @NotNull |
| | | private String background; |
| | | |
| | | @ApiModelProperty("图片") |
| | | @NotNull |
| | | private String pictures; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.menber; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.BigInteger; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class MemberGrowthRecordDTO { |
| | | @ApiModelProperty(value = "会员成长记录表ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("记录日期") |
| | | private Date recordDate; |
| | | |
| | | @ApiModelProperty("订单金额") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @ApiModelProperty("成长值") |
| | | private int growth; |
| | | |
| | | @ApiModelProperty("用户id") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("商户ID") |
| | | private BigInteger customerId; |
| | | |
| | | @ApiModelProperty("成长值来源(growth_source:签到、消费)") |
| | | private String source; |
| | | |
| | | @ApiModelProperty("新增、扣除(growth_type)") |
| | | private String type; |
| | | |
| | | @ApiModelProperty("备注") |
| | | private String remarks; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.menber; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class MemberQueryDTO { |
| | | @ApiModelProperty(value = "会员等级名称") |
| | | private String name; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.menber; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class MemberRecordQueryDTO { |
| | | @ApiModelProperty(value = "新增、扣除(growth_type)") |
| | | private String type; |
| | | @ApiModelProperty(value = "成长值来源(growth_source:签到、消费)") |
| | | private String source; |
| | | @ApiModelProperty(value = "记录开始日期") |
| | | private Date startRecordDate; |
| | | @ApiModelProperty(value = "记录结束日期") |
| | | private Date endRecordDate; |
| | | @ApiModelProperty("用户ID") |
| | | private String userId; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.menber; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | @Data |
| | | public class TargetMemberDTO { |
| | | @ApiModelProperty(value = "目标会员等级") |
| | | private String targetMemberLevel; |
| | | |
| | | @ApiModelProperty("目标会员等级要求成长值") |
| | | private int targetStartPoint; |
| | | |
| | | @ApiModelProperty("达到目标所需成长值") |
| | | private int targetGap; |
| | | |
| | | @ApiModelProperty("目标会员等级优惠金额") |
| | | private BigDecimal targetDiscountAmount; |
| | | |
| | | @ApiModelProperty("折扣类型") |
| | | private String targetDiscountType; |
| | | |
| | | @ApiModelProperty("折扣类型Str") |
| | | private String targetDiscountTypeStr; |
| | | |
| | | @ApiModelProperty("会员折扣百分比") |
| | | private BigDecimal targetDiscountRatio; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.menber; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class UserGrowthRecordDTO { |
| | | @ApiModelProperty(value = "当前会员等级") |
| | | private String currentMemberLevel; |
| | | |
| | | @ApiModelProperty("当前成长值") |
| | | private int currentGrowthValue; |
| | | |
| | | @ApiModelProperty("折扣类型") |
| | | private String currentDiscountType; |
| | | |
| | | @ApiModelProperty("折扣类型Str") |
| | | private String currentDiscountTypeStr; |
| | | |
| | | @ApiModelProperty("当前会员等级优惠金额") |
| | | private BigDecimal currentDiscountAmount; |
| | | |
| | | @ApiModelProperty("会员折扣百分比") |
| | | private BigDecimal currentDiscountRatio; |
| | | |
| | | List<TargetMemberDTO> targetMemberInfos; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.menber; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | @Data |
| | | public class UserMemberRecordQueryDTO { |
| | | @ApiModelProperty(value = "用户名称") |
| | | private String nickName; |
| | | @ApiModelProperty(value = "联系方式") |
| | | private String tel; |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class DeliveryOrderInfoSpQueryDTO { |
| | |
| | | @ApiModelProperty(value = "库位名称") |
| | | private String warehouseLocationCode; |
| | | |
| | | @ApiModelProperty(value = "日期") |
| | | private String date; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private LocalDateTime startDate; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private LocalDateTime endDate; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private List<String> statusList; |
| | | } |
| | |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class DeliveryOrderStationQueryDTO { |
| | |
| | | @ApiModelProperty(value = "库位名称") |
| | | private String warehouseLocationCode; |
| | | |
| | | @ApiModelProperty(value = "日期") |
| | | private String date; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private LocalDateTime startDate; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private LocalDateTime endDate; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private List<String> statusList; |
| | | } |
| | |
| | | |
| | | @NotBlank(message = "微信code不能为空") |
| | | private String wxcode; |
| | | |
| | | @ApiModelProperty(value = "用户优惠券id") |
| | | private String couponRecordId; |
| | | |
| | | @ApiModelProperty(value = "用户积分商品兑换券id列表") |
| | | private List<Long> goodsRecordIdList; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.payment; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class PostQueryDTO implements Serializable { |
| | | @ApiModelProperty(value = "主键列表") |
| | | private List<String> ids; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class ChangePointDTO { |
| | | |
| | | @NotNull(message = "积分不能为空") |
| | | private Integer point; |
| | | |
| | | @NotBlank(message = "备注不能为空") |
| | | private String remarks; |
| | | |
| | | @NotNull(message = "商户ID不能为空") |
| | | private Long customerId; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * packageName com.mzl.flower.dto.request.point |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className CustomerPointDetailDTO |
| | | * @date 2024/8/29 |
| | | * @description TODO |
| | | */ |
| | | @Data |
| | | public class CustomerPointDetailDTO { |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("记录日期") |
| | | private Date recordDate; |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("商户ID") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty("积分变更类型(point_change_type)增加、减少") |
| | | private String changeType; |
| | | |
| | | @ApiModelProperty("积分类型:增加(消费获取、活动获取、积分赠送),减少(积分扣减、积分兑换)") |
| | | private String type; |
| | | |
| | | @ApiModelProperty("积分(积分=使用积分+过期积分)") |
| | | private Integer point; |
| | | |
| | | @ApiModelProperty("使用积分") |
| | | private Integer usePoint; |
| | | |
| | | @ApiModelProperty("过期积分") |
| | | private Integer expiredPoint; |
| | | |
| | | @ApiModelProperty("备注(可记录积分的来源或去向,如订单号、兑换内容、活动名称等)") |
| | | private String remarks; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CustomerPointDetailQueryDTO { |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("商户ID") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty("积分变更类型(point_change_type)增加、减少") |
| | | private String changeType; |
| | | |
| | | @ApiModelProperty("积分类型:增加(消费获取、活动获取、积分赠送),减少(积分扣减、积分兑换)") |
| | | private String type; |
| | | |
| | | // @ApiModelProperty("创建日期(yyyy-mm-dd)") |
| | | // private String createDateBeginStr; |
| | | // |
| | | // @ApiModelProperty("创建日期(yyyy-mm-dd)") |
| | | // private String createDateEndStr; |
| | | // |
| | | // @ApiModelProperty(value = "创建日期(yyyy-mm-dd)",hidden = true) |
| | | // private LocalDateTime createDateBegin; |
| | | // |
| | | // @ApiModelProperty(value = "创建日期(yyyy-mm-dd)", hidden = true) |
| | | // private LocalDateTime createDateEnd; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | @Data |
| | | public class ExchangeGoodsDTO { |
| | | |
| | | @NotNull(message = "商品id不能为空") |
| | | private Long goodsId; |
| | | |
| | | @NotNull(message = "兑换数量不能为空") |
| | | private Integer num; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class PointGoodDTO { |
| | | @ApiModelProperty(value = "积分商品表ID") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("商品名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("商品描述") |
| | | private String description; |
| | | |
| | | @ApiModelProperty("库存") |
| | | private Integer stock; |
| | | |
| | | @ApiModelProperty("封面图") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty("商品图片") |
| | | private String pictures; |
| | | |
| | | @ApiModelProperty("兑换积分") |
| | | private Integer point; |
| | | |
| | | @ApiModelProperty("状态") |
| | | private String status; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class PointGoodQueryDTO { |
| | | |
| | | |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("状态") |
| | | private String status; |
| | | |
| | | // @ApiModelProperty("创建日期(yyyy-mm-dd)") |
| | | // private String createDateBeginStr; |
| | | // |
| | | // @ApiModelProperty("创建日期(yyyy-mm-dd)") |
| | | // private String createDateEndStr; |
| | | // |
| | | // @ApiModelProperty(value = "创建日期(yyyy-mm-dd)",hidden = true) |
| | | // private LocalDateTime createDateBegin; |
| | | // |
| | | // @ApiModelProperty(value = "创建日期(yyyy-mm-dd)", hidden = true) |
| | | // private LocalDateTime createDateEnd; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class PointGoodsCreateDTO { |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "商品描述") |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "库存") |
| | | private Integer stock; |
| | | |
| | | @ApiModelProperty(value = "封面图") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty(value = "商品图片") |
| | | private List<String> pictureList; |
| | | |
| | | @ApiModelProperty(value = "兑换积分") |
| | | private Integer point; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class PointGoodsQueryDTO { |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "库存-下限") |
| | | private Integer stockLower; |
| | | |
| | | @ApiModelProperty(value = "库存-上限") |
| | | private Integer stockUpper; |
| | | |
| | | @ApiModelProperty(value = "兑换积分-下限") |
| | | private Integer pointLower; |
| | | |
| | | @ApiModelProperty(value = "兑换积分-上限") |
| | | private Integer pointUpper; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class PointGoodsUpdateDTO extends PointGoodsCreateDTO{ |
| | | @ApiModelProperty(value = "id") |
| | | private Long id; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class QueryCustomerPointDTO { |
| | | |
| | | private String customerName; |
| | | |
| | | private String customerTel; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class QueryExchangeGoodsDTO { |
| | | |
| | | @ApiModelProperty(value = "兑换券状态(POINT_GOODS_RECORD_STATUS)") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "用户ID",hidden = true) |
| | | private String userId; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.request.point; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | public class QueryPointDetailDTO { |
| | | |
| | | @ApiModelProperty("客户ID") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty("记录日期") |
| | | private String recordDateStart; |
| | | |
| | | @ApiModelProperty("记录日期") |
| | | private String recordDateEnd; |
| | | |
| | | @ApiModelProperty("积分类型-point_type") |
| | | private String type; |
| | | |
| | | @ApiModelProperty("备注") |
| | | private String remarks; |
| | | |
| | | @ApiModelProperty(hidden = true) |
| | | private String userId; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CouponPointStatisVO { |
| | | |
| | | @ApiModelProperty(value = "优惠券总数") |
| | | private Integer totalAmount; |
| | | |
| | | @ApiModelProperty(value = "本月兑换优惠券总数") |
| | | private Integer curMonExchangeAmount; |
| | | |
| | | @ApiModelProperty(value = "本月兑换积分总数") |
| | | private Integer curMonExchangePointAmount; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CouponRecordResultVO extends AbstractTransDTO { |
| | | |
| | | @ApiModelProperty(value = "ID ") |
| | | private String id; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "领取用户类型(COUPON_GET_USER_TYPE)") |
| | | @DictTrans(target = "getUserTypeName",codeType = "COUPON_GET_USER_TYPE") |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | @ApiModelProperty(value = "领取用户类型") |
| | | private String getUserTypeName; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 商户名称 |
| | | */ |
| | | @ApiModelProperty(value = "店铺名称") |
| | | private String customerName; |
| | | |
| | | /** |
| | | * 电话 |
| | | */ |
| | | @ApiModelProperty(value = "联系方式") |
| | | private String tel; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE) ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | |
| | | @ApiModelProperty(value = "优惠券类型 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "状态(COUPON_RECORD_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_USED_STATUS") |
| | | private String status; |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * 有效开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "有效开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime effectiveStart; |
| | | |
| | | /** |
| | | * 有效结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "有效结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime effectiveEnd; |
| | | |
| | | |
| | | /** |
| | | * 优惠券面值 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件(满多少钱) |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | @DictTrans(target = "getTypeName",codeType = "COUPON_GET_TYPE") |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道") |
| | | private String getTypeName; |
| | | |
| | | |
| | | /** |
| | | * 订单号 |
| | | */ |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNo; |
| | | |
| | | /** |
| | | * 优惠券ID |
| | | */ |
| | | @ApiModelProperty(value = "优惠券ID") |
| | | private String couponId; |
| | | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | @ApiModelProperty(value = "用户id") |
| | | private String userId; |
| | | |
| | | /** |
| | | * 商户ID |
| | | */ |
| | | @ApiModelProperty(value = "商户ID") |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * 使用订单 |
| | | */ |
| | | @ApiModelProperty(value = "使用订单") |
| | | private String orderId; |
| | | |
| | | /** |
| | | * 使用时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usedTime; |
| | | |
| | | /** |
| | | * 优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券)") |
| | | @DictTrans(target = "categoryName",codeType = "COUPON_CATEGORY") |
| | | private String category; |
| | | |
| | | /** |
| | | * 优惠券代码 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券代码") |
| | | private String couponCode; |
| | | |
| | | /** |
| | | * 积分数量 |
| | | */ |
| | | @ApiModelProperty(value = "积分数量") |
| | | private Integer point; |
| | | |
| | | /** |
| | | * 会员等级 |
| | | */ |
| | | @ApiModelProperty(value = "会员等级") |
| | | private Integer memberId; |
| | | |
| | | @ApiModelProperty(value = "优惠券种类名称") |
| | | private String categoryName; |
| | | |
| | | @ApiModelProperty(value = "优惠券图片") |
| | | private String imageUrl; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CouponRecordVO extends CouponRecordDO { |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | private String couponDiscountTypeName; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | private String getTypeName; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | private String getUserTypeName; |
| | | |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | private String statusName; |
| | | |
| | | /** |
| | | * 商户名称 |
| | | */ |
| | | private String customerName; |
| | | |
| | | /** |
| | | * 电话 |
| | | */ |
| | | private String tel; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("活动优惠券") |
| | | public class CouponTemplateActivyVO extends AbstractTransDTO { |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券描述(使用规则)") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "总数") |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE) ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | @ApiModelProperty(value = "领取用户类型") |
| | | @DictTrans(target = "getUserTypeName",codeType = "COUPON_GET_USER_TYPE") |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime getEndDate; |
| | | |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_STATUS") |
| | | private String status; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型名称 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | @ApiModelProperty(value = "操作人") |
| | | private String createByName; |
| | | |
| | | @ApiModelProperty(value = "领取用户类型") |
| | | private String getUserTypeName; |
| | | |
| | | /** |
| | | * 已经领取数 |
| | | */ |
| | | @ApiModelProperty(value = "已经领取数") |
| | | private Integer getNum; |
| | | |
| | | /** |
| | | * 未领取数 |
| | | */ |
| | | @ApiModelProperty(value = "未领取数") |
| | | private Integer unGetNum; |
| | | |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TIME_TYPE)") |
| | | @DictTrans(target = "usageTimeTypeName",codeType = "COUPON_USAGE_TIME_TYPE") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | private Integer usageTimeNum; |
| | | |
| | | @ApiModelProperty(value = "使用时间类型(COUPON_USAGE_TYPE)") |
| | | @DictTrans(target = "usageTypeName",codeType = "COUPON_USAGE_TYPE") |
| | | private String usageType; |
| | | |
| | | @ApiModelProperty(value = "使用时间类型") |
| | | private String usageTypeName; |
| | | |
| | | @ApiModelProperty(value = "领取后有效类型名称") |
| | | private String usageTimeTypeName; |
| | | |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | @DictTrans(target = "getTypeName",codeType = "COUPON_GET_TYPE") |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | private String getTypeName; |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | @ApiModelProperty(value = "每人限领") |
| | | private Integer getLimit; |
| | | |
| | | |
| | | @ApiModelProperty(value = "发放时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * 优惠券图片 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券图片") |
| | | private String imageUrl; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CouponTemplateAppVO extends AbstractTransDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券描述(使用规则)") |
| | | private String couponDescription; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE) ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_STATUS") |
| | | private String status; |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型名称 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime getEndDate; |
| | | |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TIME_TYPE)") |
| | | @DictTrans(target = "usageTimeTypeName",codeType = "COUPON_USAGE_TIME_TYPE") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | private Integer usageTimeNum; |
| | | |
| | | @ApiModelProperty(value = "领取后有效类型名称") |
| | | private String usageTimeTypeName; |
| | | |
| | | /** |
| | | * 有效开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "有效开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime effectiveStart; |
| | | |
| | | /** |
| | | * 有效结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "有效结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime effectiveEnd; |
| | | |
| | | |
| | | /** |
| | | * 优惠券图片 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券图片") |
| | | private String imageUrl; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CouponTemplateCustomerVO extends AbstractTransDTO { |
| | | |
| | | @ApiModelProperty("用户id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("电话") |
| | | private String tel; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @ApiModel("积分记录") |
| | | public class CouponTemplatePointVO extends AbstractTransDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private String id; |
| | | |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券描述(使用规则)") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "库存") |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE) ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_STATUS") |
| | | private String status; |
| | | |
| | | /** |
| | | * 兑换积分 |
| | | */ |
| | | @ApiModelProperty(value = "所需积分数量") |
| | | private Integer point; |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型名称 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TIME_TYPE)") |
| | | @DictTrans(target = "usageTimeTypeName",codeType = "COUPON_USAGE_TIME_TYPE") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | private Integer usageTimeNum; |
| | | |
| | | @ApiModelProperty(value = "使用时间类型(COUPON_USAGE_TYPE)") |
| | | @DictTrans(target = "usageTypeName",codeType = "COUPON_USAGE_TYPE") |
| | | private String usageType; |
| | | |
| | | @ApiModelProperty(value = "使用时间类型") |
| | | private String usageTypeName; |
| | | |
| | | @ApiModelProperty(value = "领取后有效类型名称") |
| | | private String usageTimeTypeName; |
| | | |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | @DictTrans(target = "getTypeName",codeType = "COUPON_GET_TYPE") |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | private String getTypeName; |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | @ApiModelProperty(value = "每人限领") |
| | | private Integer getLimit; |
| | | |
| | | @ApiModelProperty(value = "发放时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime createTime; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @ApiModel("用户优惠券") |
| | | public class CouponTemplateUserVO extends AbstractTransDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券描述(使用规则)") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "总数") |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE) ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_STATUS") |
| | | private String status; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型名称 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | @ApiModelProperty(value = "操作人") |
| | | private String createByName; |
| | | |
| | | @ApiModelProperty(value = "商户列表") |
| | | List<CouponTemplateCustomerVO> customerList; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TIME_TYPE)") |
| | | @DictTrans(target = "usageTimeTypeName",codeType = "COUPON_USAGE_TIME_TYPE") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | private Integer usageTimeNum; |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用时间类型(COUPON_USAGE_TYPE)") |
| | | @DictTrans(target = "usageTypeName",codeType = "COUPON_USAGE_TYPE") |
| | | private String usageType; |
| | | |
| | | @ApiModelProperty(value = "使用时间类型") |
| | | private String usageTypeName; |
| | | |
| | | @ApiModelProperty(value = "领取后有效类型名称") |
| | | private String usageTimeTypeName; |
| | | |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | @DictTrans(target = "getTypeName",codeType = "COUPON_GET_TYPE") |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | private String getTypeName; |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | @ApiModelProperty(value = "每人限领") |
| | | private Integer getLimit; |
| | | |
| | | @ApiModelProperty(value = "发放时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class CouponTemplateVO extends AbstractTransDTO { |
| | | |
| | | @ApiModelProperty(value = "主键") |
| | | @DictTrans(target = "id",codeType = "id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券种类") |
| | | @DictTrans(target = "categoryName",codeType = "COUPON_CATEGORY") |
| | | private String category; |
| | | /** |
| | | * 优惠券代码(唯一) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券代码") |
| | | private String couponCode; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券描述(使用规则)") |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "发放数量") |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型 ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 最大折扣金额(可选,仅对百分比折扣类型适用) |
| | | */ |
| | | private BigDecimal maxDiscountAmount; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | @DictTrans(target = "getTypeName",codeType = "COUPON_GET_TYPE") |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | @ApiModelProperty(value = "领取用户类型(COUPON_GET_USER_TYPE)") |
| | | @DictTrans(target = "getUserTypeName",codeType = "COUPON_GET_USER_TYPE") |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "领取结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime getEndDate; |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | @ApiModelProperty(value = "每人限领") |
| | | private Integer getLimit; |
| | | |
| | | /** |
| | | * 使用时间类型(COUPON_USAGE_TYPE)与领取时间一致、固定时间、领取后有效 |
| | | */ |
| | | @ApiModelProperty(value = "使用时间类型(COUPON_USAGE_TYPE)") |
| | | @DictTrans(target = "usageTypeName",codeType = "COUPON_USAGE_TYPE") |
| | | private String usageType; |
| | | |
| | | /** |
| | | * 使用次数限制 |
| | | */ |
| | | @ApiModelProperty(value = "使用次数限制") |
| | | private Integer usageLimit; |
| | | |
| | | /** |
| | | * 每个用户的使用次数限制 |
| | | */ |
| | | @ApiModelProperty(value = "每个用户的使用次数限制") |
| | | private Integer usagePerUser; |
| | | |
| | | /** |
| | | * 使用开始时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TIME_TYPE)") |
| | | @DictTrans(target = "usageTimeTypeName",codeType = "COUPON_USAGE_TIME_TYPE") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | private Integer usageTimeNum; |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_STATUS") |
| | | private String status; |
| | | |
| | | /** |
| | | * 兑换积分 |
| | | */ |
| | | @ApiModelProperty(value = "兑换积分") |
| | | private Integer point; |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型名称 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | private String getTypeName; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | @ApiModelProperty(value = "领取用户类型") |
| | | private String getUserTypeName; |
| | | |
| | | /** |
| | | * 已经领取数 |
| | | */ |
| | | @ApiModelProperty(value = "已经领取数") |
| | | private Integer getNum; |
| | | |
| | | /** |
| | | * 未领取数 |
| | | */ |
| | | @ApiModelProperty(value = "未领取数") |
| | | private Integer unGetNum; |
| | | |
| | | @ApiModelProperty(value = "优惠券种类名称") |
| | | private String categoryName; |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | @ApiModelProperty(value = "领取后有效类型") |
| | | private String usageTimeTypeName; |
| | | |
| | | @ApiModelProperty(value = "使用时间类型") |
| | | private String usageTypeName; |
| | | |
| | | /** |
| | | * 创建人名称 |
| | | */ |
| | | @ApiModelProperty(value = "创建人名称") |
| | | private String createByName; |
| | | |
| | | /** |
| | | * 更新人名称 |
| | | */ |
| | | @ApiModelProperty(value = "更新人名称") |
| | | private String updateByName; |
| | | |
| | | @ApiModelProperty(value = "会员等级") |
| | | |
| | | private Integer memberId; |
| | | |
| | | @ApiModelProperty(value = "会员等级名称") |
| | | private String memberName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "商户列表") |
| | | List<CouponTemplateCustomerVO> customerList; |
| | | |
| | | |
| | | @ApiModelProperty(value = "会员等级对象") |
| | | private Member member; |
| | | |
| | | @ApiModelProperty(value = "发放时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty(value = "优惠券图片") |
| | | private String imageUrl; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.coupon; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class CouponTemplateVipVO extends AbstractTransDTO { |
| | | |
| | | |
| | | @ApiModelProperty(value = "ID") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券描述(使用规则)") |
| | | private String couponDescription; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型(COUPON_TYPE) ") |
| | | @DictTrans(target = "couponDiscountTypeName",codeType = "COUPON_TYPE") |
| | | private String couponDiscountType; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券面值") |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | @ApiModelProperty(value = "使用条件") |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | @ApiModelProperty(value = "优惠券状态(COUPON_STATUS)") |
| | | @DictTrans(target = "statusName",codeType = "COUPON_STATUS") |
| | | private String status; |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用开始时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | @ApiModelProperty(value = "使用结束时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | |
| | | /** |
| | | * 优惠券类型名称 COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | @ApiModelProperty(value = "优惠券类型名称 ") |
| | | private String couponDiscountTypeName; |
| | | |
| | | /** |
| | | * 状态名称 |
| | | */ |
| | | @ApiModelProperty(value = "状态名称") |
| | | private String statusName; |
| | | |
| | | @ApiModelProperty(value = "操作人") |
| | | private String createByName; |
| | | |
| | | /** |
| | | * 已经领取数 |
| | | */ |
| | | @ApiModelProperty(value = "已经领取数") |
| | | private Integer getNum; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效类型(COUPON_USAGE_TIME_TYPE)") |
| | | @DictTrans(target = "usageTimeTypeName",codeType = "COUPON_USAGE_TIME_TYPE") |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | @ApiModelProperty(value = "领取后有效时间整数") |
| | | private Integer usageTimeNum; |
| | | |
| | | @ApiModelProperty(value = "领取后有效类型名称") |
| | | private String usageTimeTypeName; |
| | | |
| | | @ApiModelProperty(value = "会员等级") |
| | | private Integer memberId; |
| | | |
| | | @ApiModelProperty(value = "会员等级名称") |
| | | private String memberName; |
| | | |
| | | @ApiModelProperty(value = "会员等级对象") |
| | | private Member member; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty(value = "使用时间类型(COUPON_USAGE_TYPE)") |
| | | @DictTrans(target = "usageTypeName",codeType = "COUPON_USAGE_TYPE") |
| | | private String usageType; |
| | | |
| | | @ApiModelProperty(value = "使用时间类型") |
| | | private String usageTypeName; |
| | | |
| | | |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | @DictTrans(target = "getTypeName",codeType = "COUPON_GET_TYPE") |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | @ApiModelProperty(value = "领取渠道(COUPON_GET_TYPE)") |
| | | private String getTypeName; |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | @ApiModelProperty(value = "每人限领") |
| | | private Integer getLimit; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | @ApiModelProperty(value = "发放数量") |
| | | private Integer couponAmount; |
| | | |
| | | @ApiModelProperty(value = "发放时间") |
| | | @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime createTime; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "是否绑定微信") |
| | | private Boolean bindWechat; |
| | | |
| | | @ApiModelProperty(value = "当前积分") |
| | | private Integer currentPoint; |
| | | |
| | | @ApiModelProperty(value = "是否总仓权限") |
| | | private Boolean mainWarehouse; |
| | | } |
| | |
| | | package com.mzl.flower.dto.response.customer; |
| | | |
| | | import com.mzl.flower.dto.request.menber.UserGrowthRecordDTO; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | @ApiModelProperty("启用/禁用") |
| | | private Boolean isEnabled; |
| | | |
| | | private UserGrowthRecordDTO userGrowthRecord; |
| | | } |
| | |
| | | private Long paramId; |
| | | |
| | | private Integer realSales;//真实销量 |
| | | |
| | | @ApiModelProperty(value = "会员价") |
| | | private BigDecimal priceMember; |
| | | |
| | | @ApiModelProperty(value = "会员价总价") |
| | | private BigDecimal totalMember; |
| | | } |
| | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | private String supplierName; |
| | | |
| | | @ApiModelProperty(value = "供应商名称") |
| | | @ApiModelProperty(value = "商品列表") |
| | | private List<FlowerCartListDTO> flowerList; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "最高价") |
| | | private BigDecimal priceHigh; |
| | | |
| | | @ApiModelProperty(value = "最低价(会员)") |
| | | private BigDecimal priceLowMember; |
| | | |
| | | @ApiModelProperty(value = "最高价(会员)") |
| | | private BigDecimal priceHighMember; |
| | | |
| | | @ApiModelProperty(value = "库存") |
| | | private Integer stock; |
| | | |
| | |
| | | private String zoneName; |
| | | |
| | | private Boolean shown;//是否显示 |
| | | |
| | | @ApiModelProperty("限购数量") |
| | | private Integer limited;//限购 |
| | | } |
| | |
| | | package com.mzl.flower.dto.response.flower; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | |
| | | private Boolean shown;//是否显示 |
| | | |
| | | private Integer zoneRank;//专区排序 |
| | | |
| | | @ApiModelProperty("限购数量") |
| | | private Integer limited;//限购 |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class FlowerShowDTO extends FlowerSupplierDTO { |
| | | |
| | |
| | | private Integer shopnum; |
| | | |
| | | private Integer realSales;//真实销量 |
| | | |
| | | @ApiModelProperty(value = "会员价") |
| | | private BigDecimal priceMember; |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | public class FlowerShowListDTO extends FlowerSupplierListDTO { |
| | | |
| | |
| | | |
| | | @ApiModelProperty(value = "是否推荐") |
| | | private Boolean recommend; |
| | | |
| | | @ApiModelProperty(value = "会员价") |
| | | private BigDecimal priceMember; |
| | | } |
| | |
| | | @ApiModelProperty(value = "描述") |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "库存") |
| | | private Integer limited; |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "价格排序") |
| | | private Integer typeRank; |
| | | |
| | | // 限购数量 |
| | | private Integer limited;// |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("供货数") |
| | | private Long totalNum; |
| | | |
| | | @ApiModelProperty("已质检供应商数量") |
| | | private Integer checkedSupplierCount; |
| | | |
| | | @ApiModelProperty("待质检供应商数量") |
| | | private Integer uncheckedSupplierCount; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.member; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigInteger; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class MemberGrowthRecordVO extends AbstractTransDTO { |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("记录日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private Date recordDate; |
| | | |
| | | @ApiModelProperty("成长值") |
| | | private int growth; |
| | | |
| | | @ApiModelProperty("用户id") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("商户ID") |
| | | private BigInteger customerId; |
| | | |
| | | @ApiModelProperty("成长值来源(growth_source:签到、消费)") |
| | | @DictTrans(target = "sourceStr", codeType = "GROWTH_SOURCE") |
| | | private String source; |
| | | |
| | | private String sourceStr; |
| | | |
| | | @ApiModelProperty("新增、扣除(growth_type)") |
| | | @DictTrans(target = "typeStr", codeType = "GROWTH_TYPE") |
| | | private String type; |
| | | |
| | | private String typeStr; |
| | | |
| | | @ApiModelProperty("备注") |
| | | private String remarks; |
| | | |
| | | @ApiModelProperty("创建日期") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("修改日期") |
| | | private LocalDateTime updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.member; |
| | | |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class MemberVO extends AbstractTransDTO { |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("会员等级名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("成长点-区间-开始") |
| | | private int startPoint; |
| | | |
| | | @ApiModelProperty("成长点-区间-结束") |
| | | private int endPoint; |
| | | |
| | | @ApiModelProperty("会员折扣类型(百分比、固定金额)") |
| | | @DictTrans(target = "discountTypeStr", codeType = "DISCOUNT_TYPE") |
| | | private String discountType; |
| | | |
| | | private String discountTypeStr; |
| | | |
| | | @ApiModelProperty("会员折扣百分比") |
| | | private BigDecimal discountRatio; |
| | | |
| | | @ApiModelProperty("会员折扣固定金额") |
| | | private BigDecimal discountAmount; |
| | | |
| | | @ApiModelProperty("消费金额(元)") |
| | | private int consumptionAmount; |
| | | |
| | | @ApiModelProperty("已消费产生的成长值") |
| | | private int growthValue; |
| | | |
| | | @ApiModelProperty("未消费产生的下降值") |
| | | private int downgradeValue; |
| | | |
| | | @ApiModelProperty("创建日期") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("修改日期") |
| | | private LocalDateTime updateTime; |
| | | |
| | | @ApiModelProperty("操作人") |
| | | private String createName; |
| | | |
| | | @ApiModelProperty("背景") |
| | | private String background; |
| | | |
| | | @ApiModelProperty("图片") |
| | | private String pictures; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.member; |
| | | |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserGrowthRecordVO extends AbstractTransDTO { |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("用户名称") |
| | | private String nickName; |
| | | |
| | | @ApiModelProperty("联系方式") |
| | | private String tel; |
| | | |
| | | @ApiModelProperty("当前成长值") |
| | | private int sumGrowthValue; |
| | | |
| | | @ApiModelProperty("当前会员等级ID") |
| | | private Long levelId; |
| | | |
| | | @ApiModelProperty("当前会员等级名称") |
| | | private String levelName; |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private String userId; |
| | | } |
| | |
| | | @ApiModelProperty(value = "账单日期") |
| | | private LocalDate billDate; |
| | | |
| | | @ApiModelProperty(value = "优惠券金额") |
| | | private BigDecimal memberCouponAmount = new BigDecimal(0); |
| | | } |
| | |
| | | private String flowerLevelStr; |
| | | |
| | | @ApiModelProperty(value = "订单商品状态") |
| | | @DictTrans(target = "statusStr", codeType = "CHECK_OPERATE") |
| | | @DictTrans(target = "statusStr", codeType = "ORDER_ITEM_STATUS") |
| | | private String status; |
| | | private String statusStr; |
| | | |
| | |
| | | @ApiModelProperty(value = "商品参数") |
| | | private List<ParamItemDTO> params; |
| | | |
| | | private Integer num; |
| | | } |
| | |
| | | package com.mzl.flower.dto.response.payment; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | |
| | | |
| | | @ApiModelProperty(value = "下单时间") |
| | | private LocalDateTime orderTime; |
| | | |
| | | @ApiModelProperty(value = "收货日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime receiveTime; |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNo; |
| | | } |
| | |
| | | @ApiModelProperty(value = "供应商总价") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @ApiModelProperty(value = "未完成质检订单数量") |
| | | private Integer uncheckedCount; |
| | | } |
| | |
| | | @Data |
| | | public class DeliveryOrderStatisticsDTO { |
| | | |
| | | @ApiModelProperty(value = "日期id") |
| | | private String id; |
| | | |
| | | @ApiModelProperty(value = "日期") |
| | | private LocalDate date; |
| | | |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | |
| | | private List<OrderItemListDTO> items; |
| | | |
| | | private String createBy; |
| | | |
| | | private BigDecimal totalAmount;//订单金额 |
| | | } |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | |
| | | private List<OrderItemLocationListDTO> items; |
| | | |
| | | private String createBy; |
| | | |
| | | @ApiModelProperty(value = "总金额") |
| | | private BigDecimal totalAmount; |
| | | } |
| | |
| | | @ApiModelProperty(value = "支付单号") |
| | | private String paymentTrId; |
| | | |
| | | @ApiModelProperty(value = "积分商品列表") |
| | | private List<OrderPointGoodsListDTO> pointGoodsList; |
| | | |
| | | @ApiModelProperty(value = "优惠券编码") |
| | | private String memberCouponCode; |
| | | |
| | | @ApiModelProperty(value = "优惠券名称") |
| | | private String memberCouponName; |
| | | |
| | | @ApiModelProperty(value = "优惠券金额") |
| | | private BigDecimal memberCouponAmount; |
| | | |
| | | @ApiModelProperty(value = "会员等级名称") |
| | | private String memberName; |
| | | |
| | | @ApiModelProperty(value = "折扣类型(discount_type)") |
| | | @DictTrans(target = "memberDiscountTypeStr", codeType = "DISCOUNT_TYPE") |
| | | private String memberDiscountType; |
| | | private String memberDiscountTypeStr; |
| | | |
| | | @ApiModelProperty(value = "会员折扣") |
| | | private BigDecimal memberDiscountRatio; |
| | | |
| | | @ApiModelProperty(value = "优惠金额(每扎)") |
| | | private BigDecimal memberDiscountAmount; |
| | | |
| | | private List<OrderItemListDTO> items; |
| | | } |
| | |
| | | public class OrderItemListDTO extends AbstractTransDTO { |
| | | private String id; |
| | | |
| | | private String orderId; |
| | | |
| | | private Long stationId;//集货站id |
| | | private String stationName; |
| | | |
| | |
| | | @ApiModelProperty(value = "总金额") |
| | | private BigDecimal total; |
| | | |
| | | @ApiModelProperty(value = "优惠券金额/扎") |
| | | private BigDecimal couponAmount; |
| | | |
| | | @ApiModelProperty(value = "优惠前售价/扎") |
| | | private BigDecimal originalPrice; |
| | | |
| | | @ApiModelProperty(value = "真实成交价格/每扎") |
| | | private BigDecimal realPrice; |
| | | |
| | | @ApiModelProperty(value = "补货数量") |
| | | private Integer replaceNum; |
| | | |
| | | @ApiModelProperty(value = "降级数量") |
| | | private Integer reduceNum; |
| | | |
| | | @ApiModelProperty(value = "缺货数量") |
| | | private Integer lackNum; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "异常未处理数量") |
| | | private Integer unProcessCount; |
| | | |
| | | @ApiModelProperty(value = "供应商缺货扣款") |
| | | private BigDecimal lackFeeSupplier; |
| | | |
| | | @ApiModelProperty(value = "供应商补货扣款") |
| | | private BigDecimal replaceFee; |
| | | |
| | | @ApiModelProperty(value = "供应商降级扣款") |
| | | private BigDecimal checkFee; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "支付单号") |
| | | private String paymentTrId; |
| | | |
| | | @ApiModelProperty(value = "特殊需求") |
| | | @DictTrans(target = "specialNeedsStr", codeType = "SPEC_REQ") |
| | | private String specialNeeds; |
| | | private String specialNeedsStr; |
| | | |
| | | @ApiModelProperty(value = "留言") |
| | | private String remarks; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "快递单号") |
| | | private String deliveryNo;//快递单号 |
| | | |
| | | @ApiModelProperty(value = "特殊需求") |
| | | @DictTrans(target = "specialNeedsStr", codeType = "SPEC_REQ") |
| | | private String specialNeeds; |
| | | private String specialNeedsStr; |
| | | |
| | | @ApiModelProperty(value = "留言") |
| | | private String remarks; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.payment; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class OrderPointGoodsListDTO { |
| | | @ApiModelProperty(value = "积分商品ID") |
| | | private Long goodsId; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "商品描述") |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "商品封面图") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty(value = "商品图片") |
| | | private String pictures; |
| | | |
| | | @ApiModelProperty(value = "兑换数量") |
| | | private Integer num; |
| | | |
| | | } |
| | |
| | | package com.mzl.flower.dto.response.payment; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class OrderSettlementDetailDTO extends AbstractTransDTO { |
| | |
| | | @ApiModelProperty(value = "售后理赔") |
| | | private BigDecimal salesFee; |
| | | |
| | | @ApiModelProperty(value = "收货日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime receiveTime; |
| | | |
| | | @ApiModelProperty(value = "质检日期") |
| | | @JsonFormat(pattern="yyyy-MM-dd" ,timezone="GMT+8") |
| | | @DateTimeFormat |
| | | private LocalDateTime checkTime; |
| | | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNo; |
| | | |
| | | private String orderId; |
| | | } |
| | |
| | | @ApiModelProperty(value = "商品总金额") |
| | | private BigDecimal totalAmount; |
| | | |
| | | @ApiModelProperty(value = "商品会员价总金额") |
| | | private BigDecimal totalMemberAmount; |
| | | |
| | | @ApiModelProperty(value = "打包费") |
| | | private BigDecimal packing; |
| | | |
| | | @ApiModelProperty(value = "会员等级id") |
| | | private Long memberId; |
| | | |
| | | @ApiModelProperty(value = "会员等级名称") |
| | | private String memberName; |
| | | |
| | | @ApiModelProperty(value = "折扣类型(discount_type)") |
| | | private String memberDiscountType; |
| | | |
| | | @ApiModelProperty(value = "会员折扣") |
| | | private BigDecimal memberDiscountRatio; |
| | | |
| | | @ApiModelProperty(value = "优惠金额(每扎)") |
| | | private BigDecimal memberDiscountAmount; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.point; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class CustomerPointDTO { |
| | | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("用户DI") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("商户ID") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty("商户名称") |
| | | private String customerName; |
| | | |
| | | @ApiModelProperty("商户联系电话") |
| | | private String customerTel; |
| | | |
| | | @ApiModelProperty("总积分") |
| | | private String totalPoint; |
| | | |
| | | @ApiModelProperty("使用积分") |
| | | private String usedPoint; |
| | | |
| | | @ApiModelProperty("过期积分") |
| | | private String expiredPoint; |
| | | |
| | | @ApiModelProperty("系统扣减积分") |
| | | private Integer deductionPoint; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.point; |
| | | |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | |
| | | @Data |
| | | public class CustomerPointDetailDTO extends AbstractTransDTO { |
| | | |
| | | @ApiModelProperty("记录日期") |
| | | private LocalDate recordDate; |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("商户ID") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty("积分变更类型-POINT_CHANGE_TYPE") |
| | | @DictTrans(target = "changeTypeStr",codeType = "POINT_CHANGE_TYPE") |
| | | private String changeType; |
| | | |
| | | @ApiModelProperty("积分类型-POINT_TYPE") |
| | | @DictTrans(target = "typeStr",codeType = "POINT_TYPE") |
| | | private String type; |
| | | |
| | | @ApiModelProperty("积分变更类型-point_change_type") |
| | | private String changeTypeStr; |
| | | |
| | | @ApiModelProperty("积分类型-POINT_TYPE") |
| | | private String typeStr; |
| | | |
| | | @ApiModelProperty("积分") |
| | | private String point; |
| | | |
| | | @ApiModelProperty("积分备注") |
| | | private String remarks; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.point; |
| | | |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | public class CustomerPointDetailVO extends AbstractTransDTO { |
| | | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("记录日期") |
| | | private Date recordDate; |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("商户ID") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty("积分变更类型(point_change_type)增加、减少") |
| | | @DictTrans(target = "changeTypeStr", codeType = "POINT_CHANGE_TYPE") |
| | | private String changeType; |
| | | |
| | | private String changeTypeStr; |
| | | |
| | | @ApiModelProperty("积分类型:增加(消费获取、活动获取、积分赠送),减少(积分扣减、积分兑换)") |
| | | @DictTrans(target = "typeStr", codeType = "POINT_TYPE") |
| | | private String type; |
| | | |
| | | private String typeStr; |
| | | |
| | | @ApiModelProperty("积分(积分=使用积分+过期积分)") |
| | | private Integer point; |
| | | |
| | | @ApiModelProperty("使用积分") |
| | | private Integer usePoint; |
| | | |
| | | @ApiModelProperty("过期积分") |
| | | private Integer expiredPoint; |
| | | |
| | | @ApiModelProperty("备注(可记录积分的来源或去向,如订单号、兑换内容、活动名称等)") |
| | | private String remarks; |
| | | |
| | | @ApiModelProperty("创建日期") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("修改日期") |
| | | private LocalDateTime updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.point; |
| | | |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class ExpiredPointDTO { |
| | | |
| | | private String userId; |
| | | |
| | | private Long customerId; |
| | | |
| | | private Integer addPoint; |
| | | |
| | | private Integer reducePoint; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.point; |
| | | |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class PointGoodVO extends AbstractTransDTO { |
| | | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("商品名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("商品描述") |
| | | private String description; |
| | | |
| | | @ApiModelProperty("库存") |
| | | private Integer stock; |
| | | |
| | | @ApiModelProperty("封面图") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty("商品图片") |
| | | private String pictures; |
| | | |
| | | @ApiModelProperty("兑换积分") |
| | | private Integer point; |
| | | |
| | | @ApiModelProperty("状态") |
| | | @DictTrans(target = "statusStr", codeType = "POINT_GOOD_STATUS") |
| | | private String status; |
| | | |
| | | private String statusStr; |
| | | |
| | | @ApiModelProperty("创建日期") |
| | | private LocalDateTime createTime; |
| | | |
| | | @ApiModelProperty("修改日期") |
| | | private LocalDateTime updateTime; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.point; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class PointGoodsDTO extends PointGoodsListDTO { |
| | | @ApiModelProperty(value = "商品图片") |
| | | private List<String> pictureList; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.point; |
| | | |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class PointGoodsListDTO extends AbstractTransDTO { |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "商品描述") |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "库存") |
| | | private Integer stock; |
| | | |
| | | @ApiModelProperty(value = "封面图") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty(value = "兑换积分") |
| | | private Integer point; |
| | | |
| | | @ApiModelProperty(value = "状态") |
| | | @DictTrans(target = "statusStr", codeType = "POINT_GOODS_STATUS") |
| | | private String status; |
| | | private String statusStr; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.dto.response.point; |
| | | |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class PointGoodsRecordDTO extends AbstractTransDTO { |
| | | |
| | | private Long id; |
| | | |
| | | @ApiModelProperty(value = "用户ID") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty(value = "商户ID") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty(value = "兑换码") |
| | | private String redeemCode; |
| | | |
| | | @ApiModelProperty(value = "积分商品ID") |
| | | private Long goodsId; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "商品描述") |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "商品封面图") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty(value = "商品图片") |
| | | private String pictures; |
| | | |
| | | @ApiModelProperty(value = "兑换积分数") |
| | | private Integer point; |
| | | |
| | | @ApiModelProperty(value = "兑换数量") |
| | | private Integer num; |
| | | |
| | | @ApiModelProperty(value = "兑换总积分") |
| | | private Integer totalPoint; |
| | | |
| | | @ApiModelProperty(value = "兑换券状态POINT_GOODS_RECORD_STATUS") |
| | | @DictTrans(target = "statusStr",codeType = "POINT_GOODS_RECORD_STATUS") |
| | | private String status; |
| | | |
| | | private String statusStr; |
| | | |
| | | @ApiModelProperty(value = "到期时间") |
| | | private LocalDateTime expireTime; |
| | | } |
| | |
| | | import com.mzl.flower.base.AbstractTransDTO; |
| | | import com.mzl.flower.base.annotation.DictTrans; |
| | | import com.mzl.flower.dto.AttachmentDTO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | |
| | | @ApiModelProperty("启用/禁用") |
| | | private Boolean isEnabled; |
| | | |
| | | @ApiModelProperty("粉丝数") |
| | | private int fans; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseEntity; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("t_coupon_record") |
| | | public class CouponRecordDO extends BaseEntity { |
| | | |
| | | |
| | | /** |
| | | * 优惠券ID |
| | | */ |
| | | private String couponId; |
| | | |
| | | /** |
| | | * 用户id |
| | | */ |
| | | private String userId; |
| | | |
| | | /** |
| | | * 商户ID |
| | | */ |
| | | private Long customerId; |
| | | |
| | | /** |
| | | * 状态(coupon_record_status)未使用、已使用、已过期 |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 有效开始时间 |
| | | */ |
| | | private LocalDateTime effectiveStart; |
| | | |
| | | /** |
| | | * 有效结束时间 |
| | | */ |
| | | private LocalDateTime effectiveEnd; |
| | | |
| | | /** |
| | | * 使用订单 |
| | | */ |
| | | private String orderId; |
| | | |
| | | /** |
| | | * 使用时间 |
| | | */ |
| | | private LocalDateTime usedTime; |
| | | |
| | | /** |
| | | * 优惠券面值 |
| | | */ |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件(满多少钱) |
| | | */ |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券) |
| | | */ |
| | | private String category; |
| | | |
| | | /** |
| | | * 优惠券代码 |
| | | */ |
| | | private String couponCode; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | private String couponName; |
| | | |
| | | private String couponDiscountType; |
| | | |
| | | private String getType; |
| | | |
| | | /** |
| | | * 用户获取类型 |
| | | */ |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 积分数量 |
| | | */ |
| | | private Integer point; |
| | | |
| | | /** |
| | | * 会员等级 |
| | | */ |
| | | private Integer memberId; |
| | | |
| | | /** |
| | | * 优惠券图片 |
| | | */ |
| | | private String imageUrl; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-24 |
| | | */ |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @TableName("t_coupon_template_customer") |
| | | public class CouponTemplateCustomerDO { |
| | | |
| | | |
| | | @TableId("id") |
| | | private String id; |
| | | |
| | | /** |
| | | * 优惠券id |
| | | */ |
| | | @TableField("coupon_id") |
| | | private String couponId; |
| | | |
| | | /** |
| | | * 指定的顾客id |
| | | */ |
| | | @TableField("custom_id") |
| | | private Long customId; |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @Accessors(chain = true) |
| | | @TableName("t_coupon_template") |
| | | public class CouponTemplateDO extends BaseEntity { |
| | | |
| | | |
| | | /** |
| | | * 优惠券种类(活动优惠券、用户优惠券、会员优惠券,积分优惠券) |
| | | */ |
| | | private String category; |
| | | /** |
| | | * 优惠券代码(唯一) |
| | | */ |
| | | private String couponCode; |
| | | |
| | | /** |
| | | * 优惠券名称 |
| | | */ |
| | | private String couponName; |
| | | |
| | | /** |
| | | * 优惠券描述(使用规则) |
| | | */ |
| | | private String couponDescription; |
| | | |
| | | /** |
| | | * 发放数量 |
| | | */ |
| | | private Integer couponAmount; |
| | | |
| | | /** |
| | | * 优惠券类型(COUPON_TYPE)满减和无门槛 |
| | | */ |
| | | private String couponDiscountType; |
| | | |
| | | /** |
| | | * 优惠券面值 折扣值(百分比或金额) |
| | | */ |
| | | private BigDecimal couponDiscountValue; |
| | | |
| | | /** |
| | | * 使用条件,最小订单金额(可选)=》使用条件 |
| | | */ |
| | | private BigDecimal minOrderAmount; |
| | | |
| | | /** |
| | | * 最大折扣金额(可选,仅对百分比折扣类型适用) |
| | | */ |
| | | private BigDecimal maxDiscountAmount; |
| | | |
| | | /** |
| | | * 领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心 |
| | | */ |
| | | private String getType; |
| | | |
| | | /** |
| | | * 领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户 |
| | | */ |
| | | private String getUserType; |
| | | |
| | | /** |
| | | * 领取开始时间 |
| | | */ |
| | | private LocalDateTime getStartDate; |
| | | |
| | | /** |
| | | * 领取结束时间 |
| | | */ |
| | | private LocalDateTime getEndDate; |
| | | |
| | | /** |
| | | * 每人限领 |
| | | */ |
| | | private Integer getLimit; |
| | | |
| | | /** |
| | | * 使用时间类型(COUPON_USAGE_TYPE)与领取时间一致、固定时间、领取后有效 |
| | | */ |
| | | private String usageType; |
| | | |
| | | /** |
| | | * 使用次数限制 |
| | | */ |
| | | private Integer usageLimit; |
| | | |
| | | /** |
| | | * 每个用户的使用次数限制 |
| | | */ |
| | | private Integer usagePerUser; |
| | | |
| | | /** |
| | | * 使用开始时间 |
| | | */ |
| | | private LocalDateTime usageStartDate; |
| | | |
| | | /** |
| | | * 使用结束时间 |
| | | */ |
| | | private LocalDateTime usageEndDate; |
| | | |
| | | /** |
| | | * 领取后有效类型(COUPON_usage_time_type)天、小时、分钟 |
| | | */ |
| | | private String usageTimeType; |
| | | |
| | | /** |
| | | * 领取后有效时间整数,比如90(天,小时,分钟) |
| | | */ |
| | | private Integer usageTimeNum; |
| | | |
| | | /** |
| | | * 优惠券状态(COUPON_STATUS) |
| | | */ |
| | | private String status; |
| | | |
| | | /** |
| | | * 兑换积分 |
| | | */ |
| | | private Integer point; |
| | | |
| | | /** |
| | | * 会员等级 |
| | | */ |
| | | private Integer memberId; |
| | | |
| | | /** |
| | | * 优惠券图片 |
| | | */ |
| | | private String imageUrl; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty("启用/禁用") |
| | | private Boolean isEnabled; |
| | | @ApiModelProperty("等级id") |
| | | private Long levelId; |
| | | } |
| | |
| | | @TableField("type_rank") |
| | | private Integer typeRank;//同类排序 |
| | | |
| | | @TableField("limited") |
| | | private Integer limited;//限购数量 |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.menber; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseAutoEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className Member |
| | | * @date 2024/8/26 |
| | | * @description 会员管理功能实体类 |
| | | */ |
| | | @Data |
| | | @TableName("t_member") |
| | | public class Member extends BaseAutoEntity { |
| | | |
| | | @ApiModelProperty("会员等级名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("成长点-区间-开始") |
| | | private int startPoint; |
| | | |
| | | @ApiModelProperty("成长点-区间-结束") |
| | | private int endPoint; |
| | | |
| | | @ApiModelProperty("会员折扣类型(百分比、固定金额)") |
| | | private String discountType; |
| | | |
| | | @ApiModelProperty("会员折扣百分比") |
| | | private BigDecimal discountRatio; |
| | | |
| | | @ApiModelProperty("会员折扣固定金额") |
| | | private BigDecimal discountAmount; |
| | | |
| | | @ApiModelProperty("消费金额(元)") |
| | | private int consumptionAmount; |
| | | |
| | | @ApiModelProperty("已消费产生的成长值") |
| | | private int growthValue; |
| | | |
| | | @ApiModelProperty("未消费产生的下降值") |
| | | private int downgradeValue; |
| | | |
| | | @ApiModelProperty("背景") |
| | | private String background; |
| | | |
| | | @ApiModelProperty("图片") |
| | | private String pictures; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.menber; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseAutoEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | /** |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className Member |
| | | * @date 2024/9/02 |
| | | * @description 会员降级记录表 |
| | | */ |
| | | @Data |
| | | @TableName("t_member_downgrade_record") |
| | | public class MemberDowngradeRecord extends BaseAutoEntity { |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("会员等级ID") |
| | | private Long memberId; |
| | | |
| | | @ApiModelProperty("会员等级名称") |
| | | private String memberName; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.menber; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseAutoEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigInteger; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className Member |
| | | * @date 2024/8/27 |
| | | * @description 会员成长记录表ID |
| | | */ |
| | | @Data |
| | | @TableName("t_member_growth_record") |
| | | public class MemberGrowthRecord extends BaseAutoEntity { |
| | | |
| | | @ApiModelProperty("记录日期") |
| | | private Date recordDate; |
| | | |
| | | @ApiModelProperty("成长值") |
| | | private int growth; |
| | | |
| | | @ApiModelProperty("用户id") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("商户ID") |
| | | private BigInteger customerId; |
| | | |
| | | @ApiModelProperty("成长值来源(growth_source:签到、消费)") |
| | | private String source; |
| | | |
| | | @ApiModelProperty("新增、扣除(growth_type)") |
| | | private String type; |
| | | |
| | | @ApiModelProperty("备注") |
| | | private String remarks; |
| | | } |
| | |
| | | @TableField("bill_date") |
| | | private LocalDate billDate;//账单日期 |
| | | |
| | | @TableField("member_coupon_amount") |
| | | private BigDecimal memberCouponAmount;//优惠券金额 |
| | | } |
| | |
| | | private String orderNo;//单号 |
| | | |
| | | @TableField("flower_amount") |
| | | private BigDecimal flowerAmount;//商品金额 |
| | | private BigDecimal flowerAmount;//商品金额(会员价) |
| | | |
| | | @TableField("packing_fee") |
| | | private BigDecimal packingFee;//打包费 |
| | |
| | | |
| | | @TableField("wx_delivery_msg") |
| | | private String wxDeliveryMsg;// 微信发货返回消息 |
| | | |
| | | @TableField("member_coupon_id") |
| | | private String memberCouponId;//用户优惠券id |
| | | |
| | | @TableField("member_coupon_code") |
| | | private String memberCouponCode;//优惠券编码 |
| | | |
| | | @TableField("member_coupon_name") |
| | | private String memberCouponName;//优惠券名称 |
| | | |
| | | @TableField("member_coupon_amount") |
| | | private BigDecimal memberCouponAmount;//优惠券金额 |
| | | |
| | | @TableField("member_id") |
| | | private Long memberId;//会员等级id |
| | | |
| | | @TableField("member_name") |
| | | private String memberName;//会员等级名称 |
| | | |
| | | @TableField("member_discount_type") |
| | | private String memberDiscountType;//折扣类型(discount_type) |
| | | |
| | | @TableField("member_discount_ratio") |
| | | private BigDecimal memberDiscountRatio;//会员折扣 |
| | | |
| | | @TableField("member_discount_amount") |
| | | private BigDecimal memberDiscountAmount;//优惠金额(每扎) |
| | | |
| | | } |
| | |
| | | private BigDecimal markupPartner;//合伙人加价 |
| | | |
| | | @TableField("price") |
| | | private BigDecimal price;//商品售价 |
| | | private BigDecimal price;//商品售价(会员价) |
| | | |
| | | @TableField("total") |
| | | private BigDecimal total;//总金额 |
| | |
| | | @TableField("deduct_amount") |
| | | private BigDecimal deductAmount;//扣款金额 |
| | | |
| | | @TableField("coupon_amount") |
| | | private BigDecimal couponAmount;//优惠券金额/扎 |
| | | |
| | | @TableField("original_price") |
| | | private BigDecimal originalPrice;//优惠前售价/扎 |
| | | |
| | | @TableField("real_price") |
| | | private BigDecimal realPrice;//真实成交价格/每扎 |
| | | |
| | | @TableField("coupon_amount_total") |
| | | private BigDecimal couponAmountTotal;//优惠券总金额 |
| | | |
| | | @TableField("real_total") |
| | | private BigDecimal realTotal;//真实成交总价格 |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.payment; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseEntity; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("t_order_point_goods") |
| | | public class OrderPointGoods extends BaseEntity { |
| | | |
| | | @TableField("order_id") |
| | | private String orderId;//订单id |
| | | |
| | | @TableField("goods_record_id") |
| | | private Long goodsRecordId;//客户商品id |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.point; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseAutoEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | @Data |
| | | @TableName("t_customer_point") |
| | | public class CustomerPoint extends BaseAutoEntity { |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("商户ID") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty("总积分") |
| | | private Integer totalPoint; |
| | | |
| | | @ApiModelProperty("使用积分") |
| | | private Integer usedPoint; |
| | | |
| | | @ApiModelProperty("过期积分") |
| | | private Integer expiredPoint; |
| | | |
| | | @ApiModelProperty("系统扣减积分") |
| | | private Integer deductionPoint; |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.point; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseAutoEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.Date; |
| | | |
| | | |
| | | /** |
| | | * packageName com.mzl.flower.entity.point |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className CustomerPointDetail |
| | | * @date 2024/8/29 |
| | | * @description 用户积分统计 |
| | | */ |
| | | |
| | | @Data |
| | | @TableName("t_customer_point_detail") |
| | | public class CustomerPointDetail extends BaseAutoEntity { |
| | | |
| | | @ApiModelProperty("记录日期") |
| | | private LocalDate recordDate; |
| | | |
| | | @ApiModelProperty("用户ID") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("商户ID") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty("积分变更类型(point_change_type)增加、减少") |
| | | private String changeType; |
| | | |
| | | @ApiModelProperty("积分类型:增加(消费获取、活动获取、积分赠送),减少(积分扣减、积分兑换)") |
| | | private String type; |
| | | |
| | | @ApiModelProperty("积分变更数量") |
| | | private Integer point; |
| | | |
| | | @ApiModelProperty("备注(可记录积分的来源或去向,如订单号、兑换内容、活动名称等)") |
| | | private String remarks; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.point; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseAutoEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className Member |
| | | * @date 2024/8/27 |
| | | * @description 积分商品表 |
| | | */ |
| | | @Data |
| | | @TableName("t_point_goods") |
| | | public class PointGood extends BaseAutoEntity { |
| | | |
| | | @ApiModelProperty("商品名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("商品描述") |
| | | private String description; |
| | | |
| | | @ApiModelProperty("库存") |
| | | private Integer stock; |
| | | |
| | | @ApiModelProperty("封面图") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty("商品图片") |
| | | private String pictures; |
| | | |
| | | @ApiModelProperty("兑换积分") |
| | | private Integer point; |
| | | |
| | | @ApiModelProperty("状态") |
| | | private String status; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.point; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseAutoEntity; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @TableName("t_point_goods") |
| | | public class PointGoods extends BaseAutoEntity { |
| | | |
| | | @TableField("name") |
| | | private String name;//商品名称 |
| | | |
| | | @TableField("description") |
| | | private String description;//商品描述 |
| | | |
| | | @TableField("stock") |
| | | private Integer stock;//库存 |
| | | |
| | | @TableField("cover") |
| | | private String cover;//封面图 |
| | | |
| | | @TableField("pictures") |
| | | private String pictures;//商品图片 |
| | | |
| | | @TableField("point") |
| | | private Integer point;//兑换积分 |
| | | |
| | | @TableField("status") |
| | | private String status;//状态 |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.entity.point; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.mzl.flower.base.BaseAutoEntity; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | @TableName("t_point_goods_record") |
| | | public class PointGoodsRecord extends BaseAutoEntity { |
| | | |
| | | @ApiModelProperty(value = "用户ID") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty(value = "商户ID") |
| | | private Long customerId; |
| | | |
| | | @ApiModelProperty(value = "兑换码") |
| | | private String redeemCode; |
| | | |
| | | @ApiModelProperty(value = "积分商品ID") |
| | | private Long goodsId; |
| | | |
| | | @ApiModelProperty(value = "商品名称") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "商品描述") |
| | | private String description; |
| | | |
| | | @ApiModelProperty(value = "商品封面图") |
| | | private String cover; |
| | | |
| | | @ApiModelProperty(value = "商品图片") |
| | | private String pictures; |
| | | |
| | | @ApiModelProperty(value = "兑换积分数") |
| | | private Integer point; |
| | | |
| | | @ApiModelProperty(value = "兑换数量") |
| | | private Integer num; |
| | | |
| | | @ApiModelProperty(value = "兑换总积分") |
| | | private Integer totalPoint; |
| | | |
| | | @ApiModelProperty(value = "兑换券状态POINT_GOODS_RECORD_STATUS") |
| | | private String status; |
| | | |
| | | @ApiModelProperty(value = "绑定订单ID") |
| | | private String orderId; |
| | | |
| | | |
| | | @ApiModelProperty(value = "到期时间") |
| | | private LocalDateTime expireTime; |
| | | } |
| | |
| | | |
| | | @TableField("third_id") |
| | | private String thirdId; |
| | | |
| | | @TableField("vip_grade") |
| | | private String vipGrade; |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponCategoryEnum { |
| | | |
| | | ACTIVITY("activity","活动优惠券"), |
| | | USER("user","用户优惠券"), |
| | | MEMBER("member","会员优惠券"), |
| | | POINT("point","积分优惠券"), |
| | | ; |
| | | |
| | | @Getter |
| | | private String status; |
| | | |
| | | private String desc; |
| | | private CouponCategoryEnum(String status, String desc){ |
| | | this.status=status; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | /** |
| | | * 优惠券领取渠道 |
| | | */ |
| | | public enum CouponGetTypeEnum { |
| | | |
| | | |
| | | HOME("home","首页弹框"), |
| | | ACTIVITY("activity","活动入口"), |
| | | CENTER("center","领券中心"), |
| | | |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private CouponGetTypeEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponGetUserTypeEnum { |
| | | |
| | | |
| | | ALL("all","全部用户"), |
| | | TARGET("target","指定用户"), |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private CouponGetUserTypeEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponStatusEnum { |
| | | |
| | | |
| | | INACTIVE("inactive","未发布"), |
| | | ACTIVE("active","已发布"), |
| | | EXPIRED("expired","下架"), |
| | | ; |
| | | |
| | | @Getter |
| | | private String status; |
| | | |
| | | private String desc; |
| | | private CouponStatusEnum(String status,String desc){ |
| | | this.status=status; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponTypeEnum { |
| | | |
| | | |
| | | DISCOUNT("discount","满减"), |
| | | ZERO("zero","无门槛"), |
| | | |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private CouponTypeEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponUsageTimeTypeEnum { |
| | | |
| | | |
| | | DAY("day","天"), |
| | | HOUR("hour","小时"), |
| | | MINUTE("minute","分钟"), |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private CouponUsageTimeTypeEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponUsageTypeEnum { |
| | | |
| | | |
| | | GET("get","与领取时间一致"), |
| | | FIXED("fixed","固定时间"), |
| | | GET_AFTER_TIME("get_after_time","领取后有效时间"), |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private CouponUsageTypeEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum CouponUsedStatusEnum { |
| | | |
| | | UNUSED("unused","待使用"), |
| | | USED("used","已使用"), |
| | | EXPIRED("expired","过期"), |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private CouponUsedStatusEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum TrueOrFalseEnum { |
| | | |
| | | |
| | | TRUE(true), |
| | | FALSE(false), |
| | | ; |
| | | |
| | | @Getter |
| | | private boolean flag; |
| | | private TrueOrFalseEnum(boolean flag){ |
| | | this.flag=flag; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.enums; |
| | | |
| | | import lombok.Getter; |
| | | |
| | | public enum VipGradeEnum { |
| | | |
| | | NORMAL("0","普通会员"), |
| | | SILVER("1","银卡会员"), |
| | | GOLD("2","金卡会员"), |
| | | DIAMOND("3","钻石会员"), |
| | | |
| | | ; |
| | | |
| | | @Getter |
| | | private String type; |
| | | |
| | | private String desc; |
| | | private VipGradeEnum(String type, String desc){ |
| | | this.type=type; |
| | | this.desc=desc; |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.coupon; |
| | | |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | public interface CouponRecordMapper extends BaseMapper<CouponRecordDO> { |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponRecordDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponStatisticsBO; |
| | | import com.mzl.flower.dto.request.coupon.QueryMineCouponRecordDTO; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordVO; |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | public interface CouponRecordMapperCustom extends BaseMapper<CouponRecordDO> { |
| | | |
| | | List<CouponRecordVO> getPage(Page page, @Param("param") QueryCouponRecordDTO dto); |
| | | |
| | | List<CouponRecordVO> getList(@Param("param") QueryCouponRecordDTO dto); |
| | | |
| | | Integer statisCouponTemplateCount(@Param("param") QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | |
| | | Integer statisCouponTemplateCurMonCount(@Param("param") QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | |
| | | Integer statisCouponPointCurMonPointAmonut(@Param("param") QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | |
| | | List<CouponRecordVO> getMineCouponRecordList(@Param("param") QueryMineCouponRecordDTO dto); |
| | | |
| | | void checkCouponExpired(@Param("param") QueryMineCouponRecordDTO dto); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.coupon; |
| | | |
| | | import com.mzl.flower.entity.coupon.CouponTemplateCustomerDO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-24 |
| | | */ |
| | | public interface CouponTemplateCustomerMapper extends BaseMapper<CouponTemplateCustomerDO> { |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.coupon; |
| | | |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | public interface CouponTemplateMapper extends BaseMapper<CouponTemplateDO> { |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.coupon.BatchCouponTemplateDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryActivePointCouponDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryActivityEffectCouponDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponDTO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateCustomerVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | public interface CouponTemplateMapperCustom extends BaseMapper<CouponTemplateDO> { |
| | | |
| | | /** |
| | | * 获取普通分页信息 |
| | | * @param page |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | List<CouponTemplateVO> getCouponTemplatePage(Page page,@Param("param") QueryCouponDTO dto); |
| | | |
| | | /** |
| | | * 获取普通会员全部列表信息 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | List<CouponTemplateVO> getList(@Param("param") QueryCouponDTO dto); |
| | | |
| | | int deleteBatchCouponTemplate(@Param("param") BatchCouponTemplateDTO dto); |
| | | |
| | | int activeBatchCouponTemplate(@Param("param") BatchCouponTemplateDTO dto); |
| | | |
| | | int expireBatchCouponTemplate(@Param("param") BatchCouponTemplateDTO dto); |
| | | |
| | | |
| | | List<CouponTemplateVO> getCouponPointList(@Param("param") QueryActivePointCouponDTO dto); |
| | | |
| | | Page<CouponTemplateVO> getPointPage(Page page,@Param("param") QueryActivePointCouponDTO dto); |
| | | |
| | | List<CouponTemplateVO> getActivityEffectList(@Param("param") QueryActivityEffectCouponDTO dto); |
| | | |
| | | /** |
| | | * 获取关联的用户信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | List<CouponTemplateCustomerVO> getCouponCustomerList(@Param("id") String id); |
| | | |
| | | List<CouponTemplateVO> getVipList(@Param("param") QueryCouponDTO dto); |
| | | |
| | | List<CouponTemplateVO> getCouponTemplateVipPage(Page page, @Param("param") QueryCouponDTO dto); |
| | | |
| | | CouponTemplateVO getHomeActivityEffectAlert(@Param("param") QueryActivityEffectCouponDTO dto); |
| | | |
| | | void expireHomeActivityCouponTemplate(); |
| | | } |
| | |
| | | import com.mzl.flower.dto.response.customer.CustomerDTO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.apache.ibatis.annotations.Update; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | |
| | | CustomerDTO getCurrentCustomer(@Param("userId") String userId); |
| | | |
| | | void bindPartner(@Param("id") Long id, @Param("partnerId")Long partnerId, @Param("userId")String userId); |
| | | |
| | | @Select("select count(1) from t_customer_info where level_id = #{levelId} and deleted = '0' ") |
| | | Integer getByLevelId(@Param("levelId") String levelId); |
| | | |
| | | @Update("UPDATE t_customer_info c " + |
| | | "JOIN ( " + |
| | | " SELECT user_id, " + |
| | | " SUM(growth) as sumgrowthvalue " + |
| | | " FROM t_member_growth_record " + |
| | | " WHERE deleted = '0' " + |
| | | " GROUP BY user_id " + |
| | | " HAVING SUM(growth) > 0 " + |
| | | ") t1 ON c.user_id = t1.user_id " + |
| | | "SET c.level_id = #{levelId} " + |
| | | "WHERE t1.sumgrowthvalue BETWEEN #{startPoint} AND #{endPoint} ") |
| | | Boolean updateMemberLevelByPoint(@Param("levelId") Long levelId, @Param("startPoint") int startPoint, @Param("endPoint") int endPoint); |
| | | |
| | | |
| | | } |
| | |
| | | @Repository |
| | | public interface FollowMapper extends BaseMapper<Follow> { |
| | | List<FollowDTO> myFollow(Page page, @Param("userId") String userId); |
| | | |
| | | Integer getStatisFansCount(@Param("supplierId") Long supplierId); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.member; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mzl.flower.entity.menber.MemberDowngradeRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | |
| | | |
| | | /** |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className MemberMapper |
| | | * @date 2024/9/2 |
| | | * @description 会员降级mapper |
| | | */ |
| | | @SuppressWarnings("ALL") |
| | | @Repository |
| | | public interface MemberDowngradeRecordMapper extends BaseMapper<MemberDowngradeRecord> { |
| | | |
| | | @Select("select count(1) from t_member_downgrade_record where user_id = #{userId} and deleted = '0' ") |
| | | Integer getMemberByName(@Param("userId") String userId); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.member; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.menber.MemberRecordQueryDTO; |
| | | import com.mzl.flower.dto.request.menber.UserMemberRecordQueryDTO; |
| | | import com.mzl.flower.dto.response.member.MemberGrowthRecordVO; |
| | | import com.mzl.flower.dto.response.member.UserGrowthRecordVO; |
| | | import com.mzl.flower.entity.menber.MemberGrowthRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className MemberMapper |
| | | * @date 2024/8/27 |
| | | * @description 会员成记录mapper |
| | | */ |
| | | @SuppressWarnings("ALL") |
| | | @Repository |
| | | public interface MemberGrowthRecordMapper extends BaseMapper<MemberGrowthRecord> { |
| | | |
| | | @Select("SELECT COALESCE(CASE WHEN SUM(growth) < 0 THEN 0 ELSE SUM(growth) END, 0) as total_growth from t_member_growth_record WHERE user_id = #{userId} and deleted = '0'") |
| | | Integer getSumGrowthByUsertId(@Param("userId") String userId); |
| | | |
| | | List<MemberGrowthRecordVO> queryPage(@Param("dto") MemberRecordQueryDTO dto, Page page); |
| | | |
| | | List<UserGrowthRecordVO> queryUserPage(@Param("dto") UserMemberRecordQueryDTO dto, Page page); |
| | | |
| | | @Select("SELECT * from t_member_growth_record WHERE user_id = #{userId} and deleted = '0' and record_date = #{localDate} and type= 'reduce' and source = 'downgrading'") |
| | | List<MemberGrowthRecordVO> selectDowngradingByUserId(@Param("userId") String userId, LocalDate localDate); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.member; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.menber.MemberQueryDTO; |
| | | import com.mzl.flower.dto.response.member.MemberVO; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className MemberMapper |
| | | * @date 2024/8/26 |
| | | * @description 会员管理功能mapper |
| | | */ |
| | | @SuppressWarnings("ALL") |
| | | @Repository |
| | | public interface MemberMapper extends BaseMapper<Member> { |
| | | |
| | | @Select("select * from t_member where end_point = #{endPoint} and deleted = '0' limit 1") |
| | | Member getEndPointByIntegerMaxValue(@Param("endPoint") Integer endPoint); |
| | | |
| | | @Select("select * from t_member where name = #{name} and deleted = '0' limit 1") |
| | | Member getMemberByName(@Param("name") String name); |
| | | |
| | | @Select("select * from t_member where start_point <= #{growthValue} and end_point > #{growthValue} and deleted = '0' limit 1") |
| | | Member getMemberByGrowthValue(@Param("growthValue") Integer growthValue); |
| | | |
| | | //获取成长值大于当前值的会员 |
| | | @Select("select * from t_member where start_point > #{growthValue} and deleted = '0' ") |
| | | List<Member> getgtMembersByGrowthValue(@Param("growthValue") Integer growthValue); |
| | | |
| | | //获取成长值区间最大值小于当前值的会员 |
| | | @Select("select * from t_member where end_point < #{growthValue} and deleted = '0' ORDER BY end_point DESC LIMIT 1") |
| | | Member getgtMembersByEndPoint(@Param("growthValue") Integer growthValue); |
| | | |
| | | List<MemberVO> queryPage(@Param("dto") MemberQueryDTO dto, Page page); |
| | | |
| | | @Select("select * from t_member where deleted = '0'") |
| | | List<Member> getAllMember(); |
| | | |
| | | @Select("select * from t_member where deleted = '0' and id != #{id} ") |
| | | List<Member> getOtherAllMember(@Param("id") Long id); |
| | | |
| | | } |
| | |
| | | List<StationStatisticDTO> statisticStationList(@Param("startDate") LocalDateTime startDate, |
| | | @Param("endDate")LocalDateTime endDate, |
| | | @Param("name") String name, |
| | | @Param("userId") String userId); |
| | | @Param("userId") String userId, |
| | | @Param("statusList") List<String> statusList); |
| | | |
| | | List<DeliveryOrder> selectSupplierDoEntity4Check(@Param("supplierId") Long supplierId |
| | | , @Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.mzl.flower.dto.response.payment.AbnormalOrderItemDTO; |
| | | import com.mzl.flower.dto.response.payment.OrderItemListDTO; |
| | | import com.mzl.flower.dto.response.payment.OrderItemPlatformListDTO; |
| | | import com.mzl.flower.entity.payment.OrderItem; |
| | | import org.apache.ibatis.annotations.Param; |
| | |
| | | List<AbnormalOrderItemDTO> getAbnormalItems(@Param("orderId") String orderId); |
| | | |
| | | List<OrderItemPlatformListDTO> getPlatformOrderItems(@Param("orderId") String orderId); |
| | | |
| | | List<OrderItemListDTO> getOrderItems(@Param("orderIds") List<String> orderIds); |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.payment.OrderQueryDTO; |
| | | import com.mzl.flower.dto.response.payment.OrderCheckListDTO; |
| | | import com.mzl.flower.dto.response.payment.OrderListDTO; |
| | | import com.mzl.flower.dto.response.payment.OrderStatusCountDTO; |
| | | import com.mzl.flower.dto.response.payment.SupplierNumDTO; |
| | | import com.mzl.flower.dto.response.payment.*; |
| | | import com.mzl.flower.entity.payment.Order; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.time.LocalDateTime; |
| | |
| | | List<Order> getOrderForBill(@Param("startTime")LocalDateTime startTime |
| | | , @Param("endTime")LocalDateTime endTime); |
| | | |
| | | Order getUserLastOrder(@Param("userId") String userId); |
| | | |
| | | List<OrderPointGoodsListDTO> getPointGoodsList(@Param("orderId") String orderId); |
| | | |
| | | @Select("SELECT t1.* " + |
| | | "FROM t_order t1 " + |
| | | "JOIN ( " + |
| | | " SELECT create_by, MAX(receive_time) AS max_time " + |
| | | " FROM t_order " + |
| | | " where receive_time is not null " + |
| | | " GROUP BY create_by " + |
| | | " HAVING max_time < NOW() - INTERVAL 30 DAY " + |
| | | ") t2 ON t1.create_by = t2.create_by AND t1.receive_time = t2.max_time " + |
| | | "LEFT JOIN t_customer_info c ON t1.create_by = c.user_id ") |
| | | List<Order> getOrderInfoByReceiveTime(); |
| | | |
| | | Integer getFlowerCompleteNumToday(@Param("userId") String userId,@Param("flowerId") Long flowerId); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.payment; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.entity.payment.OrderPointGoods; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public interface OrderPointGoodsMapper extends BaseMapper<OrderPointGoods> { |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.point; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.point.CustomerPointDetailQueryDTO; |
| | | import com.mzl.flower.dto.response.point.CustomerPointDetailVO; |
| | | import com.mzl.flower.dto.response.point.ExpiredPointDTO; |
| | | import com.mzl.flower.entity.point.CustomerPointDetail; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | |
| | | |
| | | @Repository |
| | | public interface CustomerPointDetailMapper extends BaseMapper<CustomerPointDetail> { |
| | | |
| | | List<CustomerPointDetailVO> queryPage(@Param("dto") CustomerPointDetailQueryDTO dto, Page page); |
| | | |
| | | List<ExpiredPointDTO> tongjiExpiredPoint(@Param("lastYear") LocalDate lastYear,@Param("userId") String userId); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.point; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.point.QueryCustomerPointDTO; |
| | | import com.mzl.flower.dto.request.point.QueryPointDetailDTO; |
| | | import com.mzl.flower.dto.response.point.CustomerPointDTO; |
| | | import com.mzl.flower.dto.response.point.CustomerPointDetailDTO; |
| | | import com.mzl.flower.entity.point.CustomerPoint; |
| | | import com.mzl.flower.entity.supplier.Station; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public interface CustomerPointMapper extends BaseMapper<CustomerPoint> { |
| | | |
| | | List<CustomerPointDTO> queryPage(@Param(value = "dto") QueryCustomerPointDTO dto, Page page); |
| | | |
| | | List<CustomerPointDetailDTO> queryCustomerDetails(@Param(value = "dto")QueryPointDetailDTO dto, Page page); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.point; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.point.PointGoodsQueryDTO; |
| | | import com.mzl.flower.dto.response.point.PointGoodsListDTO; |
| | | import com.mzl.flower.entity.point.PointGoods; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public interface PointGoodsMapper extends BaseMapper<PointGoods> { |
| | | List<PointGoodsListDTO> selectGoodsList(Page page, @Param("condition") PointGoodsQueryDTO dto); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.mapper.point; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.dto.request.point.QueryExchangeGoodsDTO; |
| | | import com.mzl.flower.dto.response.point.PointGoodsRecordDTO; |
| | | import com.mzl.flower.entity.point.PointGoodsRecord; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public interface PointGoodsRecordMapper extends BaseMapper<PointGoodsRecord> { |
| | | List<PointGoodsRecordDTO> selectMyExchangeGoods(@Param("dto") QueryExchangeGoodsDTO dto, Page page); |
| | | |
| | | void updateExpiredPointGoodsRecord(); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.schedule; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.response.point.ExpiredPointDTO; |
| | | import com.mzl.flower.entity.point.CustomerPoint; |
| | | import com.mzl.flower.entity.point.CustomerPointDetail; |
| | | import com.mzl.flower.mapper.point.CustomerPointDetailMapper; |
| | | import com.mzl.flower.mapper.point.CustomerPointMapper; |
| | | import com.mzl.flower.mapper.point.PointGoodsRecordMapper; |
| | | import com.mzl.flower.utils.DateUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.List; |
| | | |
| | | @Component |
| | | @Slf4j |
| | | public class PointScheduleService { |
| | | |
| | | |
| | | private final CustomerPointMapper customerPointMapper; |
| | | |
| | | private final CustomerPointDetailMapper customerPointDetailMapper; |
| | | |
| | | private final PointGoodsRecordMapper pointGoodsRecordMapper; |
| | | |
| | | public PointScheduleService(CustomerPointMapper customerPointMapper, CustomerPointDetailMapper customerPointDetailMapper, PointGoodsRecordMapper pointGoodsRecordMapper) { |
| | | this.customerPointMapper = customerPointMapper; |
| | | this.customerPointDetailMapper = customerPointDetailMapper; |
| | | this.pointGoodsRecordMapper = pointGoodsRecordMapper; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 定时计算用户过期积分 |
| | | */ |
| | | @Scheduled(cron = "0 10 0 * * ?") |
| | | public void calculatingExpiredPoint() { |
| | | log.info("过期积分计算开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | LocalDate now = LocalDate.now().minusDays(1);//前一天 |
| | | LocalDate lastYear = now.minus(1, ChronoUnit.YEARS); // 日期减去一年 |
| | | List<ExpiredPointDTO> pointDTOS = customerPointDetailMapper.tongjiExpiredPoint(lastYear,null); |
| | | if(pointDTOS != null && pointDTOS.size() > 0){ |
| | | for (ExpiredPointDTO pointDTO : pointDTOS) { |
| | | if(pointDTO.getAddPoint().intValue()> pointDTO.getReducePoint().intValue()){ //积分增加大于减少 |
| | | Integer expiredPoint = pointDTO.getAddPoint().intValue() - pointDTO.getReducePoint().intValue(); |
| | | CustomerPointDetail customerPointDetail = new CustomerPointDetail(); |
| | | customerPointDetail.setUserId(pointDTO.getUserId()); |
| | | customerPointDetail.setCustomerId(pointDTO.getCustomerId()); |
| | | customerPointDetail.setChangeType(Constants.POINT_CHANGE_TYPE.reduce.name()); |
| | | customerPointDetail.setType(Constants.POINT_TYPE.expired.name()); |
| | | customerPointDetail.setPoint(expiredPoint); |
| | | customerPointDetail.setRecordDate(lastYear); |
| | | customerPointDetail.create("sys"); |
| | | customerPointDetail.setRemarks(DateUtils.toString(now,"yyyy-MM-dd")+"过期积分结算,过期积分"+expiredPoint); |
| | | customerPointDetailMapper.insert(customerPointDetail); |
| | | |
| | | //更新用户积分记录 |
| | | CustomerPoint customerPoint = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>() |
| | | .eq(CustomerPoint::getCustomerId, pointDTO.getCustomerId()) |
| | | .eq(CustomerPoint::getUserId, pointDTO.getUserId())); |
| | | if(customerPoint == null ){ |
| | | log.error("用户积分记录不存在,userId={},customerId={}",pointDTO.getUserId(),pointDTO.getCustomerId()); |
| | | }else { |
| | | Integer expiredPointTotal = customerPoint.getExpiredPoint()==null?0:customerPoint.getExpiredPoint(); |
| | | customerPoint.setExpiredPoint(expiredPoint+expiredPointTotal); |
| | | customerPointMapper.updateById(customerPoint); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | log.info("过期积分计算结束:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 积分兑换券过期 |
| | | */ |
| | | @Scheduled(cron = "0 46 11 * * ?") |
| | | public void expiredPointGoodsRecord() { |
| | | log.info("积分兑换券过期计算开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | pointGoodsRecordMapper.updateExpiredPointGoodsRecord(); |
| | | log.info("积分兑换券过期计算开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.response.member.MemberGrowthRecordVO; |
| | | import com.mzl.flower.entity.flower.FlowerCategory; |
| | | import com.mzl.flower.entity.partner.Partner; |
| | | import com.mzl.flower.entity.payment.Order; |
| | | import com.mzl.flower.entity.payment.Transfer; |
| | | import com.mzl.flower.mapper.flower.FlowerCategoryMapper; |
| | | import com.mzl.flower.mapper.member.MemberGrowthRecordMapper; |
| | | import com.mzl.flower.mapper.partner.PartnerMapper; |
| | | import com.mzl.flower.mapper.payment.OrderMapper; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.flower.FlowerCategoryService; |
| | | import com.mzl.flower.service.flower.FlowerService; |
| | | import com.mzl.flower.service.menber.impl.GrowthValueDealService; |
| | | import com.mzl.flower.service.payment.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.time.DateFormatUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | |
| | | |
| | | @Autowired |
| | | private OrderItemSettlementService orderItemSettlementService; |
| | | |
| | | @Autowired |
| | | private GrowthValueDealService growthValueDealService; |
| | | |
| | | @Autowired |
| | | private CouponRecordService couponRecordService; |
| | | |
| | | @Autowired |
| | | private MemberGrowthRecordMapper memberGrowthRecordMapper; |
| | | |
| | | @Scheduled(cron = "1 0/30 * * * ?") |
| | | public void calculateAvePrice() { |
| | |
| | | @Scheduled(cron = "1 20 0/1 * * ?") |
| | | public void autoReceive() { |
| | | log.info("自动收货开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | orderService.autoReceive(); |
| | | List<Order> ls = orderService.autoReceive(); |
| | | if(ls != null && ls.size() > 0){ |
| | | for(Order o : ls){ |
| | | orderService.processAfterReceive(o); |
| | | } |
| | | } |
| | | log.info("自动收货结束:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | |
| | | billService.generateBill(date.plusDays(-1)); |
| | | log.info("账单结束:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | //成长值降级定时任务 |
| | | @Scheduled(cron = "0 0 5 * * ?") |
| | | public void deductGrowthValue() { |
| | | log.info("成长值扣除开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | //获取当前员工 |
| | | List<Order> orderList = orderMapper.getOrderInfoByReceiveTime(); |
| | | if(!CollectionUtils.isEmpty(orderList)){ |
| | | orderList.forEach(o->{ |
| | | try { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDate nowDate = now.toLocalDate(); |
| | | List<MemberGrowthRecordVO> memberGrowthRecordVOS = memberGrowthRecordMapper.selectDowngradingByUserId(o.getCreateBy(), nowDate); |
| | | if (CollectionUtils.isEmpty(memberGrowthRecordVOS)) { |
| | | growthValueDealService.deductionGrowthValue(o); |
| | | } |
| | | } catch (Exception e) { |
| | | // 记录错误信息,例如将错误信息写入日志 |
| | | log.info("处理订单 " + o.getId() + " 时出错: " + e.getMessage()); |
| | | } |
| | | }); |
| | | } |
| | | log.info("成长值扣除结束:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | |
| | | @Scheduled(cron = "0 30 0 1 * ?") |
| | | public void grantVipCouponRecordList() { |
| | | log.info("会员优惠券开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | couponRecordService.grantVipCouponRecordList(); |
| | | log.info("会员优惠券结束:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | @Scheduled(cron = "0 30 0 1 * ?") |
| | | public void expiredCouponRecordLastMon() { |
| | | log.info("会员优惠券开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | couponRecordService.expiredCouponRecordLastMon(); |
| | | log.info("会员优惠券结束:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | if(customerOrders!=null && customerOrders.size()>0){ //散户订单 |
| | | Map<String, WarehouseLocationDTO> customerLocationMap = new HashMap<>(); |
| | | for (Order order : customerOrders) { |
| | | Map<String, WarehouseLocationDTO> customerLocationMap = new HashMap<>(); |
| | | if(locations!=null && locations.size()>0){ |
| | | String key = order.getCreateBy()+"||"+order.getCustomerAddress(); |
| | | WarehouseLocationDTO location = null; |
| | |
| | | /** |
| | | * 每天凌晨2点,合伙人发货 |
| | | */ |
| | | @Scheduled(cron = "0 0 2 * * ?") |
| | | @Scheduled(cron = "0 0 4 * * ?") |
| | | public void clearWarehouseLocation() { |
| | | log.info("定时合伙人发货开始:" + DateFormatUtils.format(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss")); |
| | | orderService.setPartnerOrderSend(); |
| | |
| | | import com.mzl.flower.dto.response.payment.OrderSalesItemChargeDTO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.flower.*; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.entity.partner.Partner; |
| | | import com.mzl.flower.entity.payment.FeeService; |
| | | import com.mzl.flower.entity.payment.OrderItemSales; |
| | |
| | | import com.mzl.flower.entity.supplier.Supplier; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.mapper.flower.FlowerCategoryMapper; |
| | | import com.mzl.flower.mapper.member.MemberMapper; |
| | | import com.mzl.flower.mapper.partner.PartnerMapper; |
| | | import com.mzl.flower.mapper.supplier.SupplierMapper; |
| | | import com.mzl.flower.mapper.system.UserMapper; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.*; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | |
| | | |
| | | @Autowired |
| | | private FlowerCategoryMapper flowerCategoryMapper; |
| | | |
| | | @Autowired |
| | | private MemberMapper memberMapper; |
| | | |
| | | protected Member getMember(Long levelId){ |
| | | return memberMapper.selectById(levelId); |
| | | } |
| | | |
| | | @Autowired |
| | | private StringCacheClient stringCacheClient; |
| | |
| | | return p; |
| | | } |
| | | |
| | | /** |
| | | * 计算会员单价 |
| | | * |
| | | * @param price |
| | | * @param member |
| | | * @return |
| | | */ |
| | | protected BigDecimal calculateMemberPrice(BigDecimal price, Member member){ |
| | | if(price == null || member == null){ |
| | | return price; |
| | | } |
| | | BigDecimal r = price; |
| | | |
| | | String discountType = member.getDiscountType(); |
| | | if(Constants.DISCOUNT_TYPE.ratio.name().equals(discountType)){ |
| | | BigDecimal discountRatio = getAmount(member.getDiscountRatio()); |
| | | r = price.multiply(discountRatio).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP); |
| | | } else if (Constants.DISCOUNT_TYPE.amount.name().equals(discountType)){ |
| | | BigDecimal discountAmount = getAmount(member.getDiscountAmount()); |
| | | r = price.subtract(discountAmount); |
| | | } |
| | | |
| | | if(r.doubleValue() < 0){ |
| | | r = new BigDecimal(0); |
| | | } |
| | | |
| | | return r; |
| | | } |
| | | |
| | | protected Customer getCustomerByUserId(String userId){ |
| | | Customer p = customerMapper.selectOne(new QueryWrapper<Customer>() |
| | | .eq("user_id", userId)); |
| | | if(p == null){ |
| | | throw new ValidationException("客户不存在"); |
| | | } |
| | | |
| | | return p; |
| | | } |
| | | |
| | | protected Customer getCustomer(Long id){ |
| | | Customer p = customerMapper.selectById(id); |
| | | |
| | | if(p == null){ |
| | | throw new ValidationException("商户不存在"); |
| | | } |
| | | |
| | | return p; |
| | | } |
| | | |
| | | public Partner getCurrentPartner(){ |
| | | String userId = SecurityUtils.getUserId(); |
| | | Partner p = partnerMapper.selectOne(new QueryWrapper<Partner>() |
对比新文件 |
| | |
| | | package com.mzl.flower.service.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordVO; |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | public interface CouponRecordService extends IService<CouponRecordDO> { |
| | | |
| | | List<CouponRecordVO> getList(QueryCouponRecordDTO dto) ; |
| | | boolean createCouponRecord(CreateCouponRecordDTO dto); |
| | | |
| | | boolean updateCouponRecord(CreateCouponRecordDTO dto); |
| | | |
| | | boolean deleteCouponRecord(String id); |
| | | |
| | | CouponRecordVO getCouponRecordById(String id); |
| | | |
| | | Page<CouponRecordVO> getPage(Page page, QueryCouponRecordDTO dto); |
| | | |
| | | /** |
| | | * 会员定时任务 |
| | | * 根据会员等级定时下发刷优惠券 |
| | | * @return |
| | | */ |
| | | boolean grantVipCouponRecordList(); |
| | | |
| | | /** |
| | | * 根据当月日期设置上个月的日期的优惠券过期 |
| | | * @return |
| | | */ |
| | | boolean expiredCouponRecordLastMon(); |
| | | |
| | | Integer statisCouponTemplateCount(QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | |
| | | Integer statisCouponTemplateCurMonCount(QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | |
| | | Integer statisCouponPointCurMonPontAmonut(QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | |
| | | /** |
| | | * 根据优惠券种类,优惠券ID,用户的ID查找优惠券的记录数量 |
| | | * @param queryExistCouponDTO |
| | | * @return |
| | | */ |
| | | Integer getExistCouponAmount(QueryExistCouponDTO queryExistCouponDTO); |
| | | |
| | | /** |
| | | * 根据优惠券的ID来查找已经领取的优惠券的数量 |
| | | * @param couponId |
| | | * @return |
| | | */ |
| | | Integer getExistGainCouponRecordAmountById(String couponId); |
| | | |
| | | Integer getUserGainCouponRecordAmountById(String couponId,Long customerId); |
| | | |
| | | /** |
| | | * |
| | | * @param couponId |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | Integer getUserGainCouponRecordAmountByUserId(String couponId,String userId); |
| | | |
| | | List<CouponRecordVO> getMineCouponRecordList(QueryMineCouponRecordDTO dto); |
| | | |
| | | /** |
| | | * 检查优惠券是否到期 |
| | | * @param dto |
| | | */ |
| | | void checkCouponExpired(QueryMineCouponRecordDTO dto); |
| | | |
| | | boolean checkCurMonVipCouponExists(String couponId, Long customId, LocalDateTime startDateTime,LocalDateTime endDateTime); |
| | | |
| | | |
| | | /** |
| | | * 优惠券的使用 |
| | | * @param couponId 优惠券ID |
| | | * @param orderId 订单的ID |
| | | * @param orderMount 订单的金额 |
| | | * @return |
| | | */ |
| | | boolean useCoupon(String couponId, String orderId, BigDecimal orderMount); |
| | | |
| | | /** |
| | | * 优惠券退单 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | boolean cancelCouponUsage(String orderId); |
| | | |
| | | /** |
| | | * 根据订单号查找优惠券信息 |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | List<CouponRecordDO> getCouponListByOrderId(String orderId) ; |
| | | |
| | | |
| | | CouponRecordDO getCouponByOrderId(String orderId) ; |
| | | |
| | | /** |
| | | * 查看当前人员是否已经重复发过此优惠券 |
| | | * @param couponId |
| | | * @param customId |
| | | * @return |
| | | */ |
| | | boolean checkUserCouponExists(String couponId, Long customId); |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.coupon; |
| | | |
| | | import com.mzl.flower.entity.coupon.CouponTemplateCustomerDO; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-24 |
| | | */ |
| | | public interface CouponTemplateCustomerService extends IService<CouponTemplateCustomerDO> { |
| | | |
| | | /** |
| | | * 根据优惠券的id查找关联关系 |
| | | * @param couponTemplateId |
| | | * @return |
| | | */ |
| | | List<CouponTemplateCustomerDO> getPointCustomReList(String couponTemplateId); |
| | | |
| | | /** |
| | | * 根据优惠券的模版id删除关联关系 |
| | | * @param couponTemplateId |
| | | * @return |
| | | */ |
| | | boolean deleteByCouponTemplateId(String couponTemplateId); |
| | | |
| | | /** |
| | | * 根据优惠券的模版ID查找用户列表 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | List<Customer> getPointCustomerList(String id); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponPointStatisVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | public interface CouponTemplateService2 extends IService<CouponTemplateDO> { |
| | | |
| | | boolean createCouponTemplate(CreateCouponTemplateBO dto); |
| | | |
| | | |
| | | boolean updateCouponTemplate(CreateCouponTemplateBO dto); |
| | | |
| | | List<CouponTemplateVO> getList(QueryCouponDTO dto); |
| | | |
| | | Page<CouponTemplateVO> getPage(Page page, QueryCouponDTO dto); |
| | | |
| | | /** |
| | | * 详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | CouponTemplateVO getDetailById(String id); |
| | | |
| | | boolean deleteCouponTemplate(String id); |
| | | |
| | | boolean activeCouponTemplate(String id); |
| | | /** |
| | | * 活动-下架优惠券 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | boolean expireCouponTemplate(String id); |
| | | |
| | | |
| | | /** |
| | | * 获取所有会员优惠券模版 |
| | | * @return |
| | | */ |
| | | List<CouponTemplateDO> getVipCouponTemplate(); |
| | | |
| | | boolean deleteBatchCouponTemplate(BatchCouponTemplateDTO dto); |
| | | |
| | | boolean activeBatchCouponTemplate(BatchCouponTemplateDTO dto); |
| | | |
| | | boolean expireBatchCouponTemplate(BatchCouponTemplateDTO dto); |
| | | |
| | | /** |
| | | * 积分统计 |
| | | * |
| | | * @param queryCouponStatisticsBO |
| | | * @return |
| | | */ |
| | | CouponPointStatisVO statisCouponTemplatePoint(QueryCouponStatisticsBO queryCouponStatisticsBO); |
| | | |
| | | |
| | | /** |
| | | * 积分优惠券全部 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | List<CouponTemplateVO> getPointList(QueryActivePointCouponDTO dto); |
| | | |
| | | /** |
| | | * 积分优惠券列表 |
| | | * @param page |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | Page<CouponTemplateVO> getPointPage(Page page, QueryActivePointCouponDTO dto); |
| | | |
| | | /** |
| | | * 获取活动优惠券 |
| | | * 1.需要领取时间在有效期内的 |
| | | * 2.已经发布的 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | List<CouponTemplateVO> getActivityEffectList(QueryActivityEffectCouponDTO dto); |
| | | |
| | | void exchangeCoupon(ExchangeCouponDTO dto); |
| | | |
| | | /** |
| | | * 查询首页弹簧,且当前自己领取过的话则不用展示 |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | CouponTemplateVO getHomeActivityEffectAlert(QueryActivityEffectCouponDTO dto); |
| | | |
| | | } |
| | |
| | | import com.mzl.flower.dto.request.customer.ChangePartnerDTO; |
| | | import com.mzl.flower.dto.request.customer.QueryCustomerDTO; |
| | | import com.mzl.flower.dto.request.customer.UpdateCustomerDTO; |
| | | import com.mzl.flower.dto.request.menber.UserGrowthRecordDTO; |
| | | import com.mzl.flower.dto.response.customer.CustomerDTO; |
| | | import com.mzl.flower.dto.response.partner.PartnerDTO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.partner.Partner; |
| | | import com.mzl.flower.enums.TrueOrFalseEnum; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.mapper.partner.PartnerMapper; |
| | | import com.mzl.flower.service.menber.MemberGrowthRecordService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import com.mzl.flower.service.BaseService; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @Transactional |
| | | @Slf4j |
| | | public class CustomerService { |
| | | |
| | | |
| | | private final CustomerMapper customerMapper; |
| | | |
| | | private final PartnerMapper partnerMapper; |
| | | @Resource |
| | | private MemberGrowthRecordService memberGrowthRecordService; |
| | | |
| | | @Resource |
| | | private BaseService baseService; |
| | |
| | | } |
| | | |
| | | public CustomerDTO getCurrentCustomer() { |
| | | return customerMapper.getCurrentCustomer(SecurityUtils.getUserId()); |
| | | CustomerDTO currentCustomer = customerMapper.getCurrentCustomer(SecurityUtils.getUserId()); |
| | | UserGrowthRecordDTO userGrowthRecordDTO = memberGrowthRecordService.getInfoByUserId(SecurityUtils.getUserId()); |
| | | if(!ObjectUtils.isEmpty(userGrowthRecordDTO)){ |
| | | currentCustomer.setUserGrowthRecord(userGrowthRecordDTO); |
| | | } |
| | | return currentCustomer; |
| | | } |
| | | |
| | | public PartnerDTO getCurrentBindPartner() { |
| | |
| | | |
| | | customer.create(SecurityUtils.getUserId()); |
| | | customer.setIsEnabled(true); |
| | | customer.setLevelId(Long.valueOf(Constants.DEFAULT_MEMBER_ID)); |
| | | customerMapper.insert(customer); |
| | | } else {//重新修改 |
| | | customer = customerMapper.selectById(dto.getId()); |
| | |
| | | customer.update(SecurityUtils.getUserId()); |
| | | customerMapper.updateById(customer); |
| | | } |
| | | |
| | | /** |
| | | * 根据会员等级获取等级下的customer信息 |
| | | * @param levelId |
| | | * @return |
| | | */ |
| | | public List<Customer> getCustomerListByLevelId(Integer levelId){ |
| | | if(null != levelId){ |
| | | QueryWrapper<Customer> customerQueryWrapper=new QueryWrapper<>(); |
| | | customerQueryWrapper.lambda() |
| | | .eq(Customer::getDeleted, TrueOrFalseEnum.FALSE.isFlag()) |
| | | .eq(Customer::getLevelId,levelId); |
| | | return customerMapper.selectList(customerQueryWrapper); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.dto.request.customer.CreateFollowDTO; |
| | | import com.mzl.flower.dto.response.customer.FollowDTO; |
| | | import com.mzl.flower.entity.customer.Follow; |
| | | import com.mzl.flower.mapper.customer.FollowMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public int fansCount(Long supplierId) { |
| | | int count = followMapper.selectCount(new LambdaQueryWrapper<Follow>() |
| | | .eq(Follow::getSupplierId, supplierId)); |
| | | return count; |
| | | } |
| | | |
| | | |
| | | public Integer getStatisFansCount(Long supplierId) { |
| | | |
| | | Integer count = followMapper.getStatisFansCount(supplierId); |
| | | |
| | | return count; |
| | | } |
| | | } |
| | |
| | | import com.mzl.flower.dto.response.flower.FlowerCategoryDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerCategoryShowDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerCategoryTreeDTO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.flower.Flower; |
| | | import com.mzl.flower.entity.flower.FlowerCategory; |
| | | import com.mzl.flower.entity.flower.FlowerCategoryDaily; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.mapper.flower.FlowerCategoryDailyMapper; |
| | | import com.mzl.flower.mapper.flower.FlowerCategoryMapper; |
| | | import com.mzl.flower.mapper.flower.FlowerMapper; |
| | | import com.mzl.flower.mapper.member.MemberMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.utils.TreeBuilderUtil; |
| | | import io.micrometer.core.instrument.util.StringUtils; |
| | |
| | | List<FlowerCategoryTreeDTO> treeList = new ArrayList<>(); |
| | | List<FlowerCategoryTreeDTO> result = new ArrayList<>(); |
| | | if(tLs != null && tLs.size() > 0){ |
| | | Long partnerId = getCurrentCustomerPartner(); |
| | | Customer p = getCurrentCustomerWithoutCheck(); |
| | | Long partnerId = p == null ? null : p.getPartnerId(); |
| | | Long levelId = p == null ? null : p.getLevelId(); |
| | | Member member = getMember(levelId); |
| | | |
| | | for(FlowerCategoryTreeDTO t : tLs){ |
| | | if(t.getParentId() != null && t.getFlowerCount() == 0){ |
| | | continue; |
| | |
| | | JSONObject o = parseObject(ppp, JSONObject.class); |
| | | t.setPriceLow(o.getBigDecimal("priceLow")); |
| | | t.setPriceHigh(o.getBigDecimal("priceHigh")); |
| | | t.setPriceLowMember(calculateMemberPrice(t.getPriceLow(), member)); |
| | | t.setPriceHighMember(calculateMemberPrice(t.getPriceHigh(), member)); |
| | | } |
| | | |
| | | treeList.add(t); |
| | |
| | | import com.mzl.flower.entity.customer.Collect; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.flower.*; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.entity.payment.Cart; |
| | | import com.mzl.flower.entity.payment.Order; |
| | | import com.mzl.flower.entity.payment.OrderItem; |
| | |
| | | } else { |
| | | g.setPrice(dto.getPrice()); |
| | | g.setStock(dto.getStock()); |
| | | g.setLimited(dto.getLimited()); |
| | | } |
| | | |
| | | g.update(SecurityUtils.getUserId()); |
| | |
| | | public Long editFlowerAdmin(FlowerUpdateAdminDTO dto){ |
| | | Flower g = flowerMapper.selectById(dto.getId()); |
| | | g.setSales(dto.getSales()); |
| | | g.setLimited(dto.getLimited()); |
| | | g.update(SecurityUtils.getUserId()); |
| | | flowerMapper.updateById(g); |
| | | |
| | |
| | | dto.setZoneName(String.join(",", zoneNameLs)); |
| | | } |
| | | |
| | | //TODO 合伙人加价列表 |
| | | |
| | | return dto; |
| | | } |
| | | |
| | |
| | | public void deleteFlower(Long id){ |
| | | |
| | | final Flower flower = flowerMapper.selectById(id); |
| | | if(flower == null){ |
| | | throw new ValidationException("商品未找到"); |
| | | } |
| | | |
| | | flowerMapper.deleteById(id); |
| | | |
| | |
| | | dto.setUserId(SecurityUtils.getUserId()); |
| | | dto.setParamId(paramService.getParamIdByCategoryId(dto.getCategory())); |
| | | List<FlowerShowListDTO> ls = flowerMapper.selectFlowerShowList(page, dto); |
| | | if(ls != null && ls.size() > 0){ |
| | | Long partnerId = getCurrentCustomerPartner(); |
| | | for(FlowerShowListDTO s : ls){ |
| | | BigDecimal price = getFinalPrice(partnerId, s.getCategory() |
| | | , s.getId(), s.getPrice(), s.getLevel()); |
| | | s.setPrice(price); |
| | | s.setCollection(s.getCollectCount() > 0); |
| | | s.setShopnum(s.getShopnum() == null ? 0 : s.getShopnum()); |
| | | |
| | | if(s.getSales() != null && s.getRealSales() != null){ |
| | | s.setSales(s.getSales() + s.getRealSales()); |
| | | } |
| | | } |
| | | } |
| | | prepareShowList(ls); |
| | | |
| | | page.setRecords(ls); |
| | | |
| | |
| | | if(pId == null){ |
| | | pId = getCurrentCustomerPartner(); |
| | | } |
| | | Customer p = getCurrentCustomerWithoutCheck(); |
| | | Long levelId = p == null ? null : p.getLevelId(); |
| | | Member member = getMember(levelId); |
| | | |
| | | BigDecimal price = getFinalPrice(pId, dto.getCategory() |
| | | , dto.getId(), dto.getPrice(), dto.getLevel()); |
| | | dto.setPrice(price); |
| | | dto.setPriceMember(calculateMemberPrice(price, member)); |
| | | |
| | | String userId = SecurityUtils.getUserId(); |
| | | if(StringUtils.isNotEmpty(userId)) { |
| | |
| | | |
| | | dto.setParamId(paramService.getParamIdByCategoryId(dto.getCategory())); |
| | | List<FlowerShowListDTO> flowerShowListDTOS = flowerMapper.myCollect(page, dto); |
| | | prepareShowList(flowerShowListDTOS); |
| | | |
| | | page.setRecords(flowerShowListDTOS); |
| | | return page; |
| | | } |
| | | |
| | | private void prepareShowList(List<FlowerShowListDTO> ls){ |
| | | if(ls != null && ls.size() > 0){ |
| | | Customer p = getCurrentCustomerWithoutCheck(); |
| | | Long partnerId = p == null ? null : p.getPartnerId(); |
| | | Long levelId = p == null ? null : p.getLevelId(); |
| | | Member member = getMember(levelId); |
| | | |
| | | for(FlowerShowListDTO s : ls){ |
| | | BigDecimal price = getFinalPrice(partnerId, s.getCategory() |
| | | , s.getId(), s.getPrice(), s.getLevel()); |
| | | s.setPrice(price); |
| | | s.setPriceMember(calculateMemberPrice(price, member)); |
| | | |
| | | s.setCollection(s.getCollectCount() > 0); |
| | | s.setShopnum(s.getShopnum() == null ? 0 : s.getShopnum()); |
| | | |
| | | if(s.getSales() != null && s.getRealSales() != null){ |
| | | s.setSales(s.getSales() + s.getRealSales()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public Page<FlowerShowListDTO> myBrowseHistory(Page page, FlowerShowQueryDTO dto) { |
| | |
| | | }*/ |
| | | dto.setParamId(paramService.getParamIdByCategoryId(dto.getCategory())); |
| | | List<FlowerShowListDTO> flowerShowListDTOS = flowerMapper.myBrowseHistory(page, dto); |
| | | prepareShowList(flowerShowListDTOS); |
| | | |
| | | page.setRecords(flowerShowListDTOS); |
| | | return page; |
| | | } |
| | |
| | | if(dto.getZoneId()!=null && dto.getZoneId().size()>0){//添加专区 |
| | | for (Long zoneId : dto.getZoneId()) { |
| | | for(Long flowerId : dto.getIds()) { |
| | | FlowerZoneMap fzp = flowerZoneMapMapper.selectOne(new QueryWrapper<FlowerZoneMap>().eq("flower_id", flowerId).eq("zone_id", zoneId)); |
| | | FlowerZoneMap fzp = flowerZoneMapMapper.selectOne(new QueryWrapper<FlowerZoneMap>() |
| | | .eq("flower_id", flowerId).eq("zone_id", zoneId)); |
| | | if(fzp==null){ |
| | | fzp = new FlowerZoneMap(); |
| | | fzp.setFlowerId(flowerId); |
| | |
| | | return flowerDeleteDO; |
| | | } |
| | | |
| | | public void setFlowersLimited(FlowerLimitedDTO dto) { |
| | | List<Long> ids = dto.getIds(); |
| | | if (ids == null || ids.size() == 0) { |
| | | throw new ValidationException("请选择商品"); |
| | | } |
| | | for (Long id : ids) { |
| | | Flower f = flowerMapper.selectById(id); |
| | | f.setLimited(dto.getLimited()); |
| | | flowerMapper.updateById(f); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.impl.coupon; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordVO; |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.enums.*; |
| | | import com.mzl.flower.mapper.coupon.CouponRecordMapper; |
| | | import com.mzl.flower.mapper.coupon.CouponRecordMapperCustom; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.service.customer.CustomerService; |
| | | import com.mzl.flower.service.system.UserService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | import java.time.temporal.TemporalAdjusters; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class CouponRecordServiceImpl extends ServiceImpl<CouponRecordMapper, CouponRecordDO> implements CouponRecordService { |
| | | |
| | | @Autowired |
| | | private CouponRecordMapperCustom couponRecordMapperCustom; |
| | | |
| | | @Autowired |
| | | private CouponTemplateService2 couponTemplateService; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | |
| | | @Autowired |
| | | private CustomerMapper customerMapper; |
| | | |
| | | @Autowired |
| | | private CustomerService customerService; |
| | | |
| | | |
| | | @Override |
| | | public List<CouponRecordVO> getList(QueryCouponRecordDTO dto) { |
| | | return couponRecordMapperCustom.getList(dto); |
| | | } |
| | | |
| | | @Autowired |
| | | RedissonClient redissonClient; |
| | | |
| | | private static final String COUPON_KEY="com:mzl:flower:service:impl:coupon:%s"; |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean createCouponRecord(CreateCouponRecordDTO dto) { |
| | | |
| | | final CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getCouponId()); |
| | | if(couponTemplateDO==null){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | final Customer customer = customerMapper.selectById(dto.getCustomerId()); |
| | | if(null==customer){ |
| | | throw new ValidationException("商户信息不存在"); |
| | | } |
| | | |
| | | RLock lock = redissonClient.getLock(String.format(COUPON_KEY, couponTemplateDO.getId())); |
| | | try { |
| | | // 获取锁,最多等待 10 秒,锁自动释放时间 30 秒 |
| | | if (lock.tryLock(10, 30, TimeUnit.SECONDS)) { |
| | | try { |
| | | // 活动优惠券和积分优惠券需要根据库存来控制- 根据优惠券的发放数量来控制有没有超发 |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getCategory()) && ( |
| | | couponTemplateDO.getCategory().equals(CouponCategoryEnum.ACTIVITY.getStatus()) || couponTemplateDO.getCategory().equals(CouponCategoryEnum.POINT.getStatus()) |
| | | )){ |
| | | // 获取当前优惠券已经领取的数量 |
| | | final Integer gainTotal = getExistGainCouponRecordAmountById(couponTemplateDO.getId()); |
| | | if(couponTemplateDO.getCouponAmount().compareTo(gainTotal)<=0){ |
| | | throw new ValidationException("当前优惠券已经领完!"); |
| | | } |
| | | } |
| | | |
| | | // 根据用户领取设置的getLimit 查看当前用户是否已经超领优惠券 |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getCategory()) && couponTemplateDO.getCategory().equals(CouponCategoryEnum.ACTIVITY.getStatus()) ){ |
| | | // 查看当前优惠券的领取时间在不在设置的领取时间范围类 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 判断当前时间是否在领取时间范围内 |
| | | if (!(now.isAfter(couponTemplateDO.getGetStartDate()) && now.isBefore(couponTemplateDO.getGetEndDate()))) { |
| | | throw new ValidationException("当前时间不在优惠券的领取时间范围内,无法操作!"); |
| | | } |
| | | |
| | | // 获取当前优惠券已经领取的数量 |
| | | final Integer customGainTotal = getUserGainCouponRecordAmountById(couponTemplateDO.getId(),customer.getId()); |
| | | if(couponTemplateDO.getGetLimit().compareTo(customGainTotal)<=0){ |
| | | throw new ValidationException("超出个人领取限制,每人限领"+couponTemplateDO.getGetLimit()+"张!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | CouponRecordDO couponRecordDO=new CouponRecordDO(); |
| | | BeanUtils.copyProperties(dto,couponRecordDO); |
| | | couponRecordDO.create(SecurityUtils.getUserId()); |
| | | // 设置为待使用状态 |
| | | couponRecordDO.setStatus(CouponUsedStatusEnum.UNUSED.getType()); |
| | | |
| | | // 根据商户设置用户id |
| | | if(StringUtils.isBlank(dto.getUserId()) && StringUtils.isNotBlank(customer.getUserId())){ |
| | | couponRecordDO.setUserId(customer.getUserId()); |
| | | } |
| | | |
| | | // 优惠券字段冗余 |
| | | couponRecordDO.setCategory(couponTemplateDO.getCategory()); |
| | | couponRecordDO.setCouponCode(couponTemplateDO.getCouponCode()); |
| | | couponRecordDO.setCouponName(couponTemplateDO.getCouponName()); |
| | | couponRecordDO.setCouponDiscountValue(couponTemplateDO.getCouponDiscountValue()); |
| | | couponRecordDO.setMinOrderAmount(couponTemplateDO.getMinOrderAmount()); |
| | | couponRecordDO.setGetType(couponTemplateDO.getGetType()); |
| | | couponRecordDO.setCouponDiscountType(couponTemplateDO.getCouponDiscountType()); |
| | | couponRecordDO.setGetUserType(couponTemplateDO.getGetUserType()); |
| | | couponRecordDO.setPoint(couponTemplateDO.getPoint()); |
| | | couponRecordDO.setMemberId(couponTemplateDO.getMemberId()); |
| | | couponRecordDO.setImageUrl(couponTemplateDO.getImageUrl()); |
| | | |
| | | |
| | | // 根据优惠券模板来计算优惠券的生效开始时间和结束时间 |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getCategory()) && couponTemplateDO.getCategory().equals(CouponCategoryEnum.MEMBER.getStatus())){ |
| | | // 如果是会员优惠券的话,则设置为优惠券的使用条件为优惠券的时间 |
| | | couponRecordDO.setEffectiveStart(couponTemplateDO.getUsageStartDate()); |
| | | couponRecordDO.setEffectiveEnd(couponTemplateDO.getUsageEndDate()); |
| | | }else{ |
| | | // 非会员的根据领取时间类型来计算优惠券的时间 |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getUsageType()) && couponTemplateDO.getUsageType().equals(CouponUsageTypeEnum.GET.getType())){ |
| | | // 与领取时间一致 |
| | | couponRecordDO.setEffectiveStart(couponTemplateDO.getGetStartDate()); |
| | | couponRecordDO.setEffectiveEnd(couponTemplateDO.getGetEndDate()); |
| | | } |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getUsageType()) && couponTemplateDO.getUsageType().equals(CouponUsageTypeEnum.FIXED.getType())){ |
| | | // 固定时间 |
| | | couponRecordDO.setEffectiveStart(couponTemplateDO.getUsageStartDate()); |
| | | couponRecordDO.setEffectiveEnd(couponTemplateDO.getUsageEndDate()); |
| | | } |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getUsageType()) && couponTemplateDO.getUsageType().equals(CouponUsageTypeEnum.GET_AFTER_TIME.getType())){ |
| | | // 领取后有段时间 领取后有效时间 |
| | | // 根据发放后有效期来设置时间 |
| | | if (couponTemplateDO.getUsageTimeNum() == null || couponTemplateDO.getUsageTimeNum() <= 0) { |
| | | throw new ValidationException("使用时间数量必须为正整数"); |
| | | } |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | couponRecordDO.setEffectiveStart(currentTime); |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.DAY.getType())) { |
| | | // 天 |
| | | couponRecordDO.setEffectiveEnd(currentTime.plusDays(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.HOUR.getType())) { |
| | | // 小时 |
| | | couponRecordDO.setEffectiveEnd(currentTime.plusHours(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.MINUTE.getType())) { |
| | | // 分钟 |
| | | couponRecordDO.setEffectiveEnd(currentTime.plusMinutes(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | // 手动设置ID |
| | | couponRecordDO.setId(IdUtil.simpleUUID()); |
| | | return baseMapper.insert(couponRecordDO)>0; |
| | | |
| | | } finally { |
| | | lock.unlock(); |
| | | } |
| | | } |
| | | } catch (InterruptedException e) { |
| | | Thread.currentThread().interrupt(); |
| | | // 处理异常 |
| | | } |
| | | |
| | | return false; |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateCouponRecord(CreateCouponRecordDTO dto) { |
| | | CouponRecordDO couponRecordDO=baseMapper.selectById(dto.getId()); |
| | | BeanUtils.copyProperties(dto,couponRecordDO); |
| | | couponRecordDO.update(SecurityUtils.getUserId()); |
| | | |
| | | // 优惠券字段冗余 |
| | | final CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getCouponId()); |
| | | if(null!=couponTemplateDO){ |
| | | couponRecordDO.setCategory(couponTemplateDO.getCategory()); |
| | | couponRecordDO.setCouponCode(couponTemplateDO.getCouponCode()); |
| | | couponRecordDO.setCouponName(couponTemplateDO.getCouponName()); |
| | | couponRecordDO.setCouponDiscountValue(couponTemplateDO.getCouponDiscountValue()); |
| | | couponRecordDO.setMinOrderAmount(couponTemplateDO.getMinOrderAmount()); |
| | | } |
| | | |
| | | |
| | | return baseMapper.updateById(couponRecordDO)>0; |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteCouponRecord(String id) { |
| | | return baseMapper.deleteById(id)>0; |
| | | } |
| | | |
| | | @Override |
| | | public CouponRecordVO getCouponRecordById(String id) { |
| | | QueryCouponRecordDTO dto=new QueryCouponRecordDTO(); |
| | | dto.setId(id); |
| | | final List<CouponRecordVO> list = couponRecordMapperCustom.getList(dto); |
| | | if(CollectionUtils.isNotEmpty(list)){ |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Page<CouponRecordVO> getPage(Page page, QueryCouponRecordDTO dto) { |
| | | List<CouponRecordVO> result=couponRecordMapperCustom.getPage(page,dto); |
| | | return page.setRecords(result); |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean grantVipCouponRecordList() { |
| | | |
| | | try{ |
| | | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime firstDayStart = now.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0).withNano(0); |
| | | LocalDateTime lastDayEnd = now.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59).withNano(0); |
| | | |
| | | // 获取所有会员模版列表 |
| | | List<CouponTemplateDO> vipTemplateList= couponTemplateService.getVipCouponTemplate(); |
| | | |
| | | // 遍历所有相同等级用户信息,并根据优惠券设置的规则构造优惠券 |
| | | final List<CouponTemplateDO> updateCouponTemplateList = vipTemplateList.stream().map(couponTemplateDO -> { |
| | | // 获取当前等级下的所有用户 |
| | | final List<Customer> customerList = customerService.getCustomerListByLevelId(couponTemplateDO.getMemberId()); |
| | | |
| | | final List<CouponRecordDO> gradeCouponRecordList = customerList.stream().map(customer -> { |
| | | CouponRecordDO couponRecordDO = new CouponRecordDO(); |
| | | BeanUtils.copyProperties(couponTemplateDO, couponRecordDO); |
| | | couponRecordDO.setId(IdUtil.simpleUUID()); |
| | | couponRecordDO.setCouponId(couponTemplateDO.getId()); |
| | | couponRecordDO.setUserId(customer.getUserId()); |
| | | couponRecordDO.setCustomerId(customer.getId()); |
| | | couponRecordDO.setStatus(CouponUsedStatusEnum.UNUSED.getType()); |
| | | couponRecordDO.setEffectiveStart(firstDayStart); |
| | | couponRecordDO.setEffectiveEnd(lastDayEnd); |
| | | couponRecordDO.setMemberId(couponTemplateDO.getMemberId()); |
| | | couponRecordDO.setImageUrl(couponTemplateDO.getImageUrl()); |
| | | // 创建信息 |
| | | couponRecordDO.create(); |
| | | if(!checkCurMonVipCouponExists(couponRecordDO.getCouponId(),couponRecordDO.getCustomerId(),firstDayStart,lastDayEnd)){ |
| | | return couponRecordDO; |
| | | }else{ |
| | | return null; |
| | | } |
| | | |
| | | }).filter(Objects::nonNull) |
| | | .collect(Collectors.toList()); |
| | | |
| | | // 批量保存等级下的优惠券信息 |
| | | saveBatch(gradeCouponRecordList); |
| | | |
| | | couponTemplateDO.setUsageStartDate(firstDayStart); |
| | | couponTemplateDO.setUsageEndDate(lastDayEnd); |
| | | couponTemplateDO.setGetStartDate(firstDayStart); |
| | | couponTemplateDO.setGetEndDate(lastDayEnd); |
| | | |
| | | // 设置总数为当前会员的人数 |
| | | couponTemplateDO.setCouponAmount(CollectionUtils.isNotEmpty(customerList)?customerList.size():0); |
| | | |
| | | // 设置默认类型固定 |
| | | couponTemplateDO.setUsageType(CouponUsageTypeEnum.FIXED.getType()); |
| | | |
| | | return couponTemplateDO; |
| | | |
| | | }).collect(Collectors.toList()); |
| | | |
| | | // 批量更新原模版时间 |
| | | couponTemplateService.updateBatchById(updateCouponTemplateList); |
| | | |
| | | return true; |
| | | }catch (Exception e){ |
| | | // 报错日志信息报错 |
| | | log.error(e.getMessage()); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public boolean expiredCouponRecordLastMon() { |
| | | |
| | | try{ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime firstDayStart = now.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0).withNano(0); |
| | | LocalDateTime lastDayEnd = now.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59).withNano(0); |
| | | |
| | | // 只要找出时间小于当月的首天的设置成过期就可以 |
| | | |
| | | QueryWrapper<CouponRecordDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponRecordDO::getOrderId,"") |
| | | .lt(CouponRecordDO::getEffectiveEnd,firstDayStart); |
| | | |
| | | final List<CouponRecordDO> couponRecordDOS = baseMapper.selectList(queryWrapper); |
| | | |
| | | final List<CouponRecordDO> expiredCouponRecordList = couponRecordDOS.stream().map(couponRecordDO -> { |
| | | couponRecordDO.setStatus(CouponUsedStatusEnum.EXPIRED.getType()); |
| | | return couponRecordDO; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | //更新 |
| | | updateBatchById(expiredCouponRecordList); |
| | | |
| | | return true; |
| | | }catch (Exception e){ |
| | | log.error(e.getMessage()); |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public Integer statisCouponTemplateCount(QueryCouponStatisticsBO queryCouponStatisticsBO) { |
| | | return couponRecordMapperCustom.statisCouponTemplateCount(queryCouponStatisticsBO); |
| | | } |
| | | @Override |
| | | public Integer statisCouponTemplateCurMonCount(QueryCouponStatisticsBO queryCouponStatisticsBO) { |
| | | return couponRecordMapperCustom.statisCouponTemplateCurMonCount(queryCouponStatisticsBO); |
| | | } |
| | | |
| | | @Override |
| | | public Integer statisCouponPointCurMonPontAmonut(QueryCouponStatisticsBO queryCouponStatisticsBO) { |
| | | return couponRecordMapperCustom.statisCouponPointCurMonPointAmonut(queryCouponStatisticsBO); |
| | | } |
| | | |
| | | @Override |
| | | public Integer getExistCouponAmount(QueryExistCouponDTO dto) { |
| | | QueryWrapper<CouponRecordDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponRecordDO::getDeleted, TrueOrFalseEnum.FALSE.isFlag()) |
| | | .eq(StringUtils.isNotBlank(dto.getCouponId()), CouponRecordDO::getCouponId,dto.getCouponId()) |
| | | .eq(null!=dto.getCustomerId(),CouponRecordDO::getCustomerId,dto.getCustomerId()) |
| | | .eq(StringUtils.isNotBlank(dto.getCategory()),CouponRecordDO::getCategory,dto.getCategory()); |
| | | |
| | | return baseMapper.selectCount(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Integer getExistGainCouponRecordAmountById(String couponId) { |
| | | QueryWrapper<CouponRecordDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponRecordDO::getDeleted, TrueOrFalseEnum.FALSE.isFlag()) |
| | | .eq(StringUtils.isNotBlank(couponId), CouponRecordDO::getCouponId,couponId) |
| | | ; |
| | | return baseMapper.selectCount(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Integer getUserGainCouponRecordAmountById(String couponId, Long customerId) { |
| | | QueryWrapper<CouponRecordDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponRecordDO::getDeleted, TrueOrFalseEnum.FALSE.isFlag()) |
| | | .eq(StringUtils.isNotBlank(couponId), CouponRecordDO::getCouponId,couponId) |
| | | .eq(null!=customerId,CouponRecordDO::getCustomerId,customerId) |
| | | ; |
| | | |
| | | return baseMapper.selectCount(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public Integer getUserGainCouponRecordAmountByUserId(String couponId, String userId) { |
| | | QueryWrapper<CouponRecordDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponRecordDO::getDeleted, TrueOrFalseEnum.FALSE.isFlag()) |
| | | .eq(StringUtils.isNotBlank(couponId), CouponRecordDO::getCouponId,couponId) |
| | | .eq(null!=userId,CouponRecordDO::getUserId,userId) |
| | | ; |
| | | |
| | | return baseMapper.selectCount(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<CouponRecordVO> getMineCouponRecordList(QueryMineCouponRecordDTO dto) { |
| | | checkCouponExpired(dto); |
| | | return couponRecordMapperCustom.getMineCouponRecordList(dto); |
| | | } |
| | | |
| | | @Override |
| | | public void checkCouponExpired(QueryMineCouponRecordDTO dto) { |
| | | if(StringUtils.isBlank(dto.getUserId())){ |
| | | dto.setUserId(SecurityUtils.getUserId()); |
| | | } |
| | | // 将未使用的优惠券直接过期 |
| | | couponRecordMapperCustom.checkCouponExpired(dto); |
| | | } |
| | | |
| | | @Override |
| | | public boolean checkCurMonVipCouponExists(String couponId, Long customId, LocalDateTime startDateTime, LocalDateTime endDateTime) { |
| | | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime firstDayStart = now.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0).withNano(0); |
| | | LocalDateTime lastDayEnd = now.with(TemporalAdjusters.lastDayOfMonth()).withHour(23).withMinute(59).withSecond(59).withNano(0); |
| | | if(null==startDateTime){ |
| | | startDateTime=firstDayStart; |
| | | } |
| | | if(null==endDateTime){ |
| | | endDateTime=lastDayEnd; |
| | | } |
| | | |
| | | QueryWrapper<CouponRecordDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponRecordDO::getDeleted,TrueOrFalseEnum.FALSE.isFlag()) |
| | | .eq(CouponRecordDO::getCouponId,couponId) |
| | | .eq(CouponRecordDO::getCustomerId,customId) |
| | | .eq(CouponRecordDO::getEffectiveStart,startDateTime) |
| | | .eq(CouponRecordDO::getEffectiveEnd,endDateTime); |
| | | return baseMapper.selectCount(queryWrapper)>0; |
| | | |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean useCoupon(String couponId, String orderId, BigDecimal orderMount) { |
| | | // 优惠券为空 |
| | | if(StringUtils.isBlank(couponId)){ |
| | | throw new ValidationException("无效的优惠券"); |
| | | } |
| | | if(StringUtils.isBlank(orderId)){ |
| | | throw new ValidationException("订单id不能为空"); |
| | | } |
| | | if(orderMount.compareTo(BigDecimal.ZERO)<=0){ |
| | | throw new ValidationException("订单金额不能小于0"); |
| | | } |
| | | |
| | | // 验证优惠券存在且有效 |
| | | final CouponRecordDO couponRecordDO = baseMapper.selectById(couponId); |
| | | if(null==couponRecordDO || StringUtils.isNotBlank(couponRecordDO.getOrderId()) ){ |
| | | throw new ValidationException("无效的优惠券"); |
| | | } |
| | | |
| | | if(couponRecordDO.getStatus().equals(CouponUsedStatusEnum.USED.getType())){ |
| | | throw new ValidationException("优惠券已经被使用"); |
| | | } |
| | | if(couponRecordDO.getStatus().equals(CouponUsedStatusEnum.EXPIRED.getType()) || LocalDateTime.now().isAfter(couponRecordDO.getEffectiveEnd())){ |
| | | throw new ValidationException("优惠券已过期"); |
| | | } |
| | | |
| | | // 根据类型判断是无门槛还是满减,如果是无门槛 |
| | | if(couponRecordDO.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType())){ |
| | | // 无门槛,查看金额是否大于满减值 |
| | | if(orderMount.compareTo(couponRecordDO.getCouponDiscountValue())<0){ |
| | | throw new ValidationException(String.format("订单金额(%s)小于无门槛的金额(%s)", orderMount, couponRecordDO.getCouponDiscountValue())); |
| | | } |
| | | } |
| | | |
| | | if(couponRecordDO.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType())){ |
| | | //满减,查看金额是否满足最小订单额 |
| | | if(orderMount.compareTo(couponRecordDO.getMinOrderAmount())<0){ |
| | | throw new ValidationException(String.format("订单金额(%s)小于最低折扣订单金额(%s)", orderMount, couponRecordDO.getMinOrderAmount())); |
| | | } |
| | | |
| | | if(orderMount.compareTo(couponRecordDO.getCouponDiscountValue())<0){ |
| | | throw new ValidationException(String.format("订单金额(%s)小于折扣的金额(%s)", orderMount, couponRecordDO.getCouponDiscountValue())); |
| | | } |
| | | } |
| | | |
| | | // 查看当前的优惠券是否是当前人员的 |
| | | if(!SecurityUtils.getUserId().equals(couponRecordDO.getUserId())){ |
| | | throw new ValidationException("优惠券不属于当前人员"); |
| | | } |
| | | |
| | | // 优惠券使用操作 |
| | | couponRecordDO.setStatus(CouponUsedStatusEnum.USED.getType()); |
| | | couponRecordDO.setUsedTime(LocalDateTime.now()); |
| | | couponRecordDO.setOrderId(orderId); |
| | | |
| | | return baseMapper.updateById(couponRecordDO)>0; |
| | | |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean cancelCouponUsage(String orderId) { |
| | | // 查询订单使用的优惠券 |
| | | final CouponRecordDO couponRecordDO = getCouponByOrderId(orderId); |
| | | if(null==couponRecordDO){ |
| | | return false; |
| | | } |
| | | log.info("优惠券退回之前:"+ JSON.toJSONString(couponRecordDO)); |
| | | couponRecordDO.setStatus(CouponUsedStatusEnum.UNUSED.getType()); |
| | | couponRecordDO.setUsedTime(null); |
| | | couponRecordDO.setOrderId(null); |
| | | log.info("优惠券退回之后:"+ JSON.toJSONString(couponRecordDO)); |
| | | return baseMapper.updateById(couponRecordDO)>0; |
| | | } |
| | | |
| | | @Override |
| | | public List<CouponRecordDO> getCouponListByOrderId(String orderId) { |
| | | QueryWrapper<CouponRecordDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponRecordDO::getDeleted,TrueOrFalseEnum.FALSE.isFlag()) |
| | | .eq(CouponRecordDO::getOrderId,orderId); |
| | | |
| | | return baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public CouponRecordDO getCouponByOrderId(String orderId) { |
| | | final List<CouponRecordDO> couponRecordDOList = getCouponListByOrderId(orderId); |
| | | if(CollectionUtils.isNotEmpty(couponRecordDOList)){ |
| | | return couponRecordDOList.get(0); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public boolean checkUserCouponExists(String couponId, Long customId) { |
| | | QueryWrapper<CouponRecordDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponRecordDO::getDeleted,TrueOrFalseEnum.FALSE.isFlag()) |
| | | .eq(CouponRecordDO::getCouponId,couponId) |
| | | .eq(CouponRecordDO::getCustomerId,customId) |
| | | ; |
| | | return baseMapper.selectCount(queryWrapper)>0; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.impl.coupon; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateCustomerDO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.mapper.coupon.CouponTemplateCustomerMapper; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.service.coupon.CouponTemplateCustomerService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-24 |
| | | */ |
| | | @Service |
| | | public class CouponTemplateCustomerServiceImpl extends ServiceImpl<CouponTemplateCustomerMapper, CouponTemplateCustomerDO> implements CouponTemplateCustomerService { |
| | | |
| | | @Autowired |
| | | private CustomerMapper customerMapper; |
| | | |
| | | @Override |
| | | public List<CouponTemplateCustomerDO> getPointCustomReList(String id) { |
| | | QueryWrapper<CouponTemplateCustomerDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponTemplateCustomerDO::getCouponId,id); |
| | | return baseMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public boolean deleteByCouponTemplateId(String couponTemplateId) { |
| | | QueryWrapper<CouponTemplateCustomerDO> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(CouponTemplateCustomerDO::getCouponId,couponTemplateId); |
| | | return baseMapper.delete(queryWrapper)>0; |
| | | } |
| | | |
| | | @Override |
| | | public List<Customer> getPointCustomerList(String id) { |
| | | final List<CouponTemplateCustomerDO> pointCustomReList = getPointCustomReList(id); |
| | | final List<Long> customerList = pointCustomReList.stream().map(CouponTemplateCustomerDO::getCustomId).collect(Collectors.toList()); |
| | | final List<Customer> customers = customerMapper.selectBatchIds(customerList); |
| | | return customers; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.impl.coupon; |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponPointStatisVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateCustomerVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateCustomerDO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.entity.point.CustomerPoint; |
| | | import com.mzl.flower.entity.point.CustomerPointDetail; |
| | | import com.mzl.flower.enums.*; |
| | | import com.mzl.flower.mapper.coupon.CouponTemplateMapper; |
| | | import com.mzl.flower.mapper.coupon.CouponTemplateMapperCustom; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.mapper.point.CustomerPointDetailMapper; |
| | | import com.mzl.flower.mapper.point.CustomerPointMapper; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.coupon.CouponTemplateCustomerService; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.service.menber.MemberService; |
| | | import com.mzl.flower.service.payment.RedisLockService; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | | * 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @Service |
| | | public class CouponTemplateServiceImpl2 extends ServiceImpl<CouponTemplateMapper, CouponTemplateDO> implements CouponTemplateService2 { |
| | | |
| | | @Autowired |
| | | private CouponTemplateMapperCustom couponTemplateMapperCustom; |
| | | |
| | | @Autowired |
| | | private CouponTemplateCustomerService pointCustomReService; |
| | | |
| | | @Autowired |
| | | private CouponRecordService couponRecordService; |
| | | |
| | | @Autowired |
| | | private CustomerMapper customerMapper; |
| | | |
| | | @Autowired |
| | | private CustomerPointMapper customerPointMapper; |
| | | |
| | | @Autowired |
| | | private CouponTemplateService2 couponTemplateService; |
| | | |
| | | @Autowired |
| | | private CustomerPointDetailMapper customerPointDetailMapper; |
| | | |
| | | @Autowired |
| | | private MemberService memberService; |
| | | |
| | | @Autowired |
| | | private RedisLockService lockService; |
| | | |
| | | |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean createCouponTemplate(CreateCouponTemplateBO dto) { |
| | | CouponTemplateDO couponTemplateDO = new CouponTemplateDO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateDO); |
| | | // 设置id,关联使用到的id |
| | | couponTemplateDO.setId(IdUtil.simpleUUID()); |
| | | |
| | | couponTemplateDO.create(SecurityUtils.getUserId()); |
| | | if (StringUtils.isBlank(dto.getStatus())) { |
| | | // 优惠券状态 初始化为未激活状态 |
| | | couponTemplateDO.setStatus(CouponStatusEnum.INACTIVE.getStatus()); |
| | | } |
| | | |
| | | // 指定会员:需要添加制定用户的关联信息 |
| | | if (CollectionUtils.isNotEmpty(dto.getPointCostomIdList())) { |
| | | |
| | | final List<CouponTemplateCustomerDO> couponCustomList = dto.getPointCostomIdList().stream().map(customId -> { |
| | | CouponTemplateCustomerDO customReDO = new CouponTemplateCustomerDO(); |
| | | // 解决本地不加ID不报错,线上报错问题 |
| | | customReDO.setId(IdUtil.simpleUUID()); |
| | | customReDO.setCouponId(couponTemplateDO.getId()); |
| | | customReDO.setCustomId(customId); |
| | | return customReDO; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | // 批量插入 优惠券与指定用户关联关系 |
| | | pointCustomReService.saveBatch(couponCustomList); |
| | | |
| | | // 设置优惠券的数量 |
| | | couponTemplateDO.setCouponAmount(dto.getPointCostomIdList().size()); |
| | | |
| | | } |
| | | |
| | | return baseMapper.insert(couponTemplateDO) > 0; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean updateCouponTemplate(CreateCouponTemplateBO dto) { |
| | | CouponTemplateDO couponTemplateDO = baseMapper.selectById(dto.getId()); |
| | | BeanUtils.copyProperties(dto, couponTemplateDO); |
| | | couponTemplateDO.update(SecurityUtils.getUserId()); |
| | | |
| | | if (CollectionUtils.isNotEmpty(dto.getPointCostomIdList())) { |
| | | // 根据优惠券的信息删除关联信息 |
| | | pointCustomReService.deleteByCouponTemplateId(couponTemplateDO.getId()); |
| | | } |
| | | // 指定会员:需要添加制定用户的关联信息 |
| | | if (CollectionUtils.isNotEmpty(dto.getPointCostomIdList())) { |
| | | |
| | | final List<CouponTemplateCustomerDO> couponCustomList = dto.getPointCostomIdList().stream().map(customId -> { |
| | | CouponTemplateCustomerDO customReDO = new CouponTemplateCustomerDO(); |
| | | // 解决本地不加ID不报错,线上报错问题 |
| | | customReDO.setId(IdUtil.simpleUUID()); |
| | | customReDO.setCouponId(couponTemplateDO.getId()); |
| | | customReDO.setCustomId(customId); |
| | | return customReDO; |
| | | }).collect(Collectors.toList()); |
| | | |
| | | // 批量插入 优惠券与指定用户关联关系 |
| | | pointCustomReService.saveBatch(couponCustomList); |
| | | |
| | | // 设置优惠券总数当前人数 |
| | | couponTemplateDO.setCouponAmount(couponCustomList.size()); |
| | | |
| | | } |
| | | |
| | | |
| | | return baseMapper.updateById(couponTemplateDO) > 0; |
| | | } |
| | | |
| | | @Override |
| | | public List<CouponTemplateVO> getList(QueryCouponDTO dto) { |
| | | |
| | | List<CouponTemplateVO> list =new ArrayList<>(); |
| | | if(StringUtils.isNotBlank(dto.getCategory()) |
| | | && dto.getCategory().equals(CouponCategoryEnum.MEMBER.getStatus()) |
| | | ){ |
| | | // 会员优惠券 |
| | | list = couponTemplateMapperCustom.getVipList(dto); |
| | | }else{ |
| | | list = couponTemplateMapperCustom.getList(dto); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public Page<CouponTemplateVO> getPage(Page page, QueryCouponDTO dto) { |
| | | List<CouponTemplateVO> result =new ArrayList<>(); |
| | | if(StringUtils.isNotBlank(dto.getCategory()) |
| | | && dto.getCategory().equals(CouponCategoryEnum.MEMBER.getStatus()) |
| | | ){ |
| | | // 会员优惠券 |
| | | result = couponTemplateMapperCustom.getCouponTemplateVipPage(page, dto); |
| | | }else{ |
| | | result = couponTemplateMapperCustom.getCouponTemplatePage(page, dto); |
| | | } |
| | | return page.setRecords(result); |
| | | } |
| | | |
| | | @Override |
| | | public CouponTemplateVO getDetailById(String id) { |
| | | QueryCouponDTO dto = new QueryCouponDTO(); |
| | | dto.setId(id); |
| | | final List<CouponTemplateVO> list = getList(dto); |
| | | if (CollectionUtils.isNotEmpty(list)) { |
| | | CouponTemplateVO vo =list.get(0); |
| | | // 用户获取 |
| | | if(StringUtils.isNotBlank(vo.getCategory()) |
| | | && vo.getCategory().equals(CouponCategoryEnum.USER.getStatus())){ |
| | | List<CouponTemplateCustomerVO> customerList= couponTemplateMapperCustom.getCouponCustomerList(id); |
| | | vo.setCustomerList(customerList); |
| | | } |
| | | // 会员等级 |
| | | if(StringUtils.isNotBlank(vo.getCategory()) && null!=vo.getMemberId() |
| | | && vo.getCategory().equals(CouponCategoryEnum.MEMBER.getStatus())){ |
| | | final Member member = memberService.getById(vo.getMemberId()); |
| | | if(null!=member){ |
| | | vo.setMember(member); |
| | | vo.setMemberName(member.getName()); |
| | | } |
| | | |
| | | } |
| | | |
| | | return vo; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean deleteCouponTemplate(String id) { |
| | | return baseMapper.deleteById(id) > 0; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean activeCouponTemplate(String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = baseMapper.selectById(id); |
| | | couponTemplateDO.setStatus(CouponStatusEnum.ACTIVE.getStatus()); |
| | | |
| | | // 判断当前的优惠券的用户类型是指定用户还是全部用户,如果是指定用户的情况下需要发布优惠券 |
| | | if (StringUtils.isNotBlank(couponTemplateDO.getGetUserType()) |
| | | && StringUtils.isNotBlank(couponTemplateDO.getCategory()) |
| | | && couponTemplateDO.getGetUserType().equals(CouponGetUserTypeEnum.TARGET.getType()) |
| | | && couponTemplateDO.getCategory().equals(CouponCategoryEnum.USER.getStatus()) |
| | | ) { |
| | | |
| | | // 获取当前优惠券下的指定人员信息 |
| | | List<CouponTemplateCustomerDO> couponTemplateCustomerDOList = pointCustomReService.getPointCustomReList(id); |
| | | |
| | | if (CollectionUtils.isNotEmpty(couponTemplateCustomerDOList)) { |
| | | |
| | | // 根据发放后有效期来设置时间 |
| | | if (couponTemplateDO.getUsageTimeNum() == null || couponTemplateDO.getUsageTimeNum() <= 0) { |
| | | throw new ValidationException("使用时间数量必须为正整数"); |
| | | } |
| | | LocalDateTime currentTime = LocalDateTime.now(); |
| | | couponTemplateDO.setUsageStartDate(currentTime); |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.DAY.getType())) { |
| | | // 天 |
| | | couponTemplateDO.setUsageEndDate(currentTime.plusDays(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.HOUR.getType())) { |
| | | // 小时 |
| | | couponTemplateDO.setUsageEndDate(currentTime.plusHours(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | if (couponTemplateDO.getUsageTimeType().equals(CouponUsageTimeTypeEnum.MINUTE.getType())) { |
| | | // 分钟 |
| | | couponTemplateDO.setUsageEndDate(currentTime.plusMinutes(couponTemplateDO.getUsageTimeNum())); |
| | | } |
| | | |
| | | // 优惠券的总数等于下发人员的总数 |
| | | couponTemplateDO.setCouponAmount(couponTemplateCustomerDOList.size()); |
| | | |
| | | List<CouponRecordDO> couponUsageDOList = couponTemplateCustomerDOList.stream().map(pointCustomRe -> { |
| | | |
| | | CouponRecordDO couponRecordDO = new CouponRecordDO(); |
| | | |
| | | couponRecordDO.setId(IdUtil.simpleUUID()); |
| | | couponRecordDO.setCouponId(pointCustomRe.getCouponId()); |
| | | couponRecordDO.setCustomerId(pointCustomRe.getCustomId()); |
| | | final Customer customer = customerMapper.selectById(pointCustomRe.getCustomId()); |
| | | if (null != customer && StringUtils.isNotBlank(customer.getUserId())) { |
| | | // 设置所属用户id |
| | | couponRecordDO.setUserId(customer.getUserId()); |
| | | } |
| | | couponRecordDO.setStatus(CouponUsedStatusEnum.UNUSED.getType()); |
| | | |
| | | // 设置优惠券的使用开始时间 |
| | | couponRecordDO.setEffectiveStart(couponTemplateDO.getUsageStartDate()); |
| | | // 设置优惠券的使用结束时间 |
| | | couponRecordDO.setEffectiveEnd(couponTemplateDO.getUsageEndDate()); |
| | | |
| | | // 优惠券的冗余字段 |
| | | couponRecordDO.setCouponCode(couponTemplateDO.getCouponCode()); |
| | | couponRecordDO.setCouponName(couponTemplateDO.getCouponName()); |
| | | // 优惠券种类 |
| | | couponRecordDO.setCategory(couponTemplateDO.getCategory()); |
| | | couponRecordDO.setMinOrderAmount(couponTemplateDO.getMinOrderAmount()); |
| | | couponRecordDO.setCouponDiscountValue(couponTemplateDO.getCouponDiscountValue()); |
| | | couponRecordDO.setGetType(couponTemplateDO.getGetType()); |
| | | couponRecordDO.setCouponDiscountType(couponTemplateDO.getCouponDiscountType()); |
| | | couponRecordDO.setGetUserType(couponTemplateDO.getGetUserType()); |
| | | couponRecordDO.setPoint(couponTemplateDO.getPoint()); |
| | | couponRecordDO.setMemberId(couponTemplateDO.getMemberId()); |
| | | couponRecordDO.setImageUrl(couponTemplateDO.getImageUrl()); |
| | | |
| | | // 创建相关信息 |
| | | couponRecordDO.create(SecurityUtils.getUserId()); |
| | | |
| | | // 查看当前优惠券是不是已经存在,存在的话则不能添加,防止同一人员重复下发同一张指定的优惠券 |
| | | if(!couponRecordService.checkUserCouponExists(pointCustomRe.getCouponId(),pointCustomRe.getCustomId())){ |
| | | return couponRecordDO; |
| | | }else{ |
| | | return null; |
| | | } |
| | | |
| | | }).filter(Objects::nonNull).collect(Collectors.toList()); |
| | | |
| | | // 批量保存优惠券信息 |
| | | couponRecordService.saveBatch(couponUsageDOList); |
| | | } |
| | | } |
| | | |
| | | // 如果是活动优惠券且领取渠道是Home类型的,那么只能设置当前优惠券为激活状态,其他优惠券是激活状态的设置为下架状态 |
| | | if (StringUtils.isNotBlank(couponTemplateDO.getCategory()) && couponTemplateDO.getCategory().equals(CouponCategoryEnum.ACTIVITY.getStatus()) |
| | | && StringUtils.isNotBlank(couponTemplateDO.getGetType()) && couponTemplateDO.getGetType().equals(CouponGetTypeEnum.HOME.getType()) |
| | | ) { |
| | | |
| | | couponTemplateMapperCustom.expireHomeActivityCouponTemplate(); |
| | | } |
| | | |
| | | return baseMapper.updateById(couponTemplateDO) > 0; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean expireCouponTemplate(String id) { |
| | | CouponTemplateDO couponTemplateDO = baseMapper.selectById(id); |
| | | couponTemplateDO.setStatus(CouponStatusEnum.EXPIRED.getStatus()); |
| | | return baseMapper.updateById(couponTemplateDO) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 获取所有会员优惠券模版 |
| | | * |
| | | * @return |
| | | */ |
| | | @Transactional |
| | | @Override |
| | | public List<CouponTemplateDO> getVipCouponTemplate() { |
| | | QueryWrapper<CouponTemplateDO> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.lambda() |
| | | .eq(CouponTemplateDO::getDeleted, TrueOrFalseEnum.FALSE.isFlag()) |
| | | .eq(CouponTemplateDO::getCategory, CouponCategoryEnum.MEMBER.getStatus()) |
| | | .eq(CouponTemplateDO::getStatus, CouponStatusEnum.ACTIVE.getStatus()); |
| | | |
| | | return baseMapper.selectList(queryWrapper); |
| | | |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean deleteBatchCouponTemplate(BatchCouponTemplateDTO dto) { |
| | | |
| | | if (CollectionUtils.isNotEmpty(dto.getIdList())) { |
| | | dto.setUpdateBy(SecurityUtils.getUserId()); |
| | | return couponTemplateMapperCustom.deleteBatchCouponTemplate(dto) > 0; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean activeBatchCouponTemplate(BatchCouponTemplateDTO dto) { |
| | | if (CollectionUtils.isNotEmpty(dto.getIdList())) { |
| | | dto.setUpdateBy(SecurityUtils.getUserId()); |
| | | return couponTemplateMapperCustom.activeBatchCouponTemplate(dto) > 0; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Transactional |
| | | @Override |
| | | public boolean expireBatchCouponTemplate(BatchCouponTemplateDTO dto) { |
| | | if (CollectionUtils.isNotEmpty(dto.getIdList())) { |
| | | dto.setUpdateBy(SecurityUtils.getUserId()); |
| | | return couponTemplateMapperCustom.expireBatchCouponTemplate(dto) > 0; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public CouponPointStatisVO statisCouponTemplatePoint(QueryCouponStatisticsBO queryCouponStatisticsBO) { |
| | | CouponPointStatisVO vo=new CouponPointStatisVO(); |
| | | //优惠券总数 |
| | | vo.setTotalAmount(couponRecordService.statisCouponTemplateCount(queryCouponStatisticsBO)); |
| | | // 本月兑换优惠券总数 |
| | | vo.setCurMonExchangeAmount(couponRecordService.statisCouponTemplateCurMonCount(queryCouponStatisticsBO)); |
| | | // 本月兑换积分总数 |
| | | vo.setCurMonExchangePointAmount(couponRecordService.statisCouponPointCurMonPontAmonut(queryCouponStatisticsBO)); |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public List<CouponTemplateVO> getPointList(QueryActivePointCouponDTO dto) { |
| | | if(StringUtils.isBlank(dto.getOrderStr())){ |
| | | dto.setOrderStr(" create_time desc "); |
| | | } |
| | | return couponTemplateMapperCustom.getCouponPointList(dto); |
| | | } |
| | | |
| | | @Override |
| | | public Page<CouponTemplateVO> getPointPage(Page page, QueryActivePointCouponDTO dto) { |
| | | if(StringUtils.isBlank(dto.getOrderStr())){ |
| | | dto.setOrderStr(" create_time desc "); |
| | | } |
| | | return couponTemplateMapperCustom.getPointPage(page,dto); |
| | | } |
| | | |
| | | @Override |
| | | public void exchangeCoupon(ExchangeCouponDTO dto) { |
| | | |
| | | String key="EXCHANGE_COUPON:"+dto.getCouponId()+":"+SecurityUtils.getUserId(); |
| | | boolean lock = lockService.getObjectLock(key, ""); |
| | | if(!lock){ |
| | | throw new ValidationException("系统操作频繁,请稍后重试"); |
| | | } |
| | | try { |
| | | dto.setNum(1); |
| | | final CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getCouponId()); |
| | | if(couponTemplateDO==null){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | CustomerPoint cp = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>() |
| | | .eq(CustomerPoint::getUserId, SecurityUtils.getUserId())); |
| | | if(cp == null || (cp.getTotalPoint()-cp.getUsedPoint()-cp.getExpiredPoint()- cp.getExpiredPoint()) < couponTemplateDO.getPoint() * dto.getNum()){ |
| | | throw new ValidationException("积分不足"); |
| | | } |
| | | |
| | | CreateCouponRecordDTO recordDTO =new CreateCouponRecordDTO(); |
| | | recordDTO.setCouponId(dto.getCouponId()); |
| | | recordDTO.setUserId(SecurityUtils.getUserId()); |
| | | Customer customer = customerMapper.selectOne(new LambdaQueryWrapper<Customer>() |
| | | .eq(Customer::getUserId, SecurityUtils.getUserId())); |
| | | if(customer == null){ |
| | | throw new ValidationException("商户不存在"); |
| | | } |
| | | recordDTO.setCustomerId(customer.getId()); |
| | | couponRecordService.createCouponRecord(recordDTO); |
| | | |
| | | //更新积分汇总 |
| | | cp.setUsedPoint(cp.getUsedPoint()+couponTemplateDO.getPoint()); |
| | | customerPointMapper.updateById(cp); |
| | | |
| | | //记录积分明细 |
| | | CustomerPointDetail detail = new CustomerPointDetail(); |
| | | detail.setUserId(customer.getUserId()); |
| | | detail.setCustomerId(customer.getId()); |
| | | detail.setPoint(couponTemplateDO.getPoint()); |
| | | detail.setChangeType(Constants.POINT_CHANGE_TYPE.reduce.name()); |
| | | detail.setType(Constants.POINT_TYPE.exchange.name()); |
| | | detail.setRecordDate(LocalDate.now()); |
| | | detail.setRemarks(couponTemplateDO.getCouponName()); |
| | | detail.create(SecurityUtils.getUserId()); |
| | | customerPointDetailMapper.insert(detail); |
| | | }catch (Exception e){ |
| | | throw new ValidationException("兑换失败"); |
| | | }finally { |
| | | lockService.releaseObjectLock(key,""); |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public CouponTemplateVO getHomeActivityEffectAlert(QueryActivityEffectCouponDTO dto) { |
| | | |
| | | // 存在用户是空的情况 |
| | | final CouponTemplateVO homeActivityEffectAlert = couponTemplateMapperCustom.getHomeActivityEffectAlert(dto); |
| | | if(null!=homeActivityEffectAlert ){ |
| | | if(StringUtils.isNotBlank(SecurityUtils.getUserId()) ){ |
| | | // 查看当前已经领取了几张 |
| | | final Integer getCnt = couponRecordService.getUserGainCouponRecordAmountByUserId(homeActivityEffectAlert.getId(), SecurityUtils.getUserId()); |
| | | // 如果当前领取的数量小于限制领取的数量的时候,可以再次领取 |
| | | if(null!=homeActivityEffectAlert.getGetLimit() && null!=getCnt |
| | | && homeActivityEffectAlert.getGetLimit().compareTo(getCnt)>0){ |
| | | return homeActivityEffectAlert; |
| | | } |
| | | }else{ |
| | | return homeActivityEffectAlert; |
| | | } |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public List<CouponTemplateVO> getActivityEffectList(QueryActivityEffectCouponDTO dto) { |
| | | |
| | | return couponTemplateMapperCustom.getActivityEffectList(dto); |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.menber; |
| | | |
| | | import com.mzl.flower.entity.payment.Order; |
| | | |
| | | /** |
| | | * packageName com.mzl.flower.service.menber |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className GrowthValueDeductionStrategy |
| | | * @date 2024/9/2 |
| | | * @description 成长值扣除策略 |
| | | */ |
| | | public interface GrowthValueDeductionStrategy { |
| | | public void deduct(Order order); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.menber; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mzl.flower.dto.request.menber.MemberGrowthRecordDTO; |
| | | import com.mzl.flower.dto.request.menber.MemberRecordQueryDTO; |
| | | import com.mzl.flower.dto.request.menber.UserGrowthRecordDTO; |
| | | import com.mzl.flower.dto.request.menber.UserMemberRecordQueryDTO; |
| | | import com.mzl.flower.dto.response.member.MemberGrowthRecordVO; |
| | | import com.mzl.flower.dto.response.member.UserGrowthRecordVO; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.entity.menber.MemberGrowthRecord; |
| | | import com.mzl.flower.entity.payment.Order; |
| | | |
| | | |
| | | public interface MemberGrowthRecordService extends IService<MemberGrowthRecord> { |
| | | |
| | | void saveMemberGrowthRecord(MemberGrowthRecordDTO memberGrowthRecordDTO); |
| | | void updateMemberGrowthRecord(MemberGrowthRecordDTO memberGrowthRecordDTO); |
| | | void deleteMemberGrowthRecord(String id); |
| | | UserGrowthRecordDTO getInfoByUserId(String userId); |
| | | |
| | | Page<MemberGrowthRecordVO> queryPage(MemberRecordQueryDTO memberRecordQueryDTO, Page page); |
| | | |
| | | Member getMemberByUserId(String userId); |
| | | |
| | | void growthValueDeduct(Order order); |
| | | |
| | | Page<UserGrowthRecordVO> queryUserPage(UserMemberRecordQueryDTO userMemberRecordQueryDTO, Page page); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.menber; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.mzl.flower.dto.request.menber.MemberDTO; |
| | | import com.mzl.flower.dto.request.menber.MemberQueryDTO; |
| | | import com.mzl.flower.dto.response.member.MemberVO; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | |
| | | |
| | | public interface MemberService extends IService<Member> { |
| | | |
| | | void saveMember(MemberDTO memberDTO); |
| | | |
| | | void updateMember(MemberDTO memberDTO); |
| | | void deleteMember(String id); |
| | | Page<MemberVO> queryPage(MemberQueryDTO memberQueryDTO, Page page); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.menber.impl; |
| | | |
| | | import com.mzl.flower.entity.payment.Order; |
| | | import com.mzl.flower.service.menber.GrowthValueDeductionStrategy; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * packageName com.mzl.flower.service.menber.impl |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className FristDeductionStrategy |
| | | * @date 2024/9/2 |
| | | * @description TODO |
| | | */ |
| | | @Transactional |
| | | @RequiredArgsConstructor |
| | | @Service("FirstDeduction") |
| | | public class FirstDeductionStrategy implements GrowthValueDeductionStrategy { |
| | | |
| | | @Override |
| | | public void deduct(Order order) { |
| | | |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.menber.impl; |
| | | |
| | | import com.mzl.flower.entity.payment.Order; |
| | | import com.mzl.flower.service.menber.GrowthValueDeductionStrategy; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | |
| | | /** |
| | | * packageName com.mzl.flower.service.menber.impl |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className GrowthValueDealService |
| | | * @date 2024/9/2 |
| | | * @description TODO |
| | | */ |
| | | |
| | | @Service |
| | | public class GrowthValueDealService { |
| | | |
| | | @Resource |
| | | private GrowthValueStrategyContext growthValueStrategyContext; |
| | | public void deductionGrowthValue(Order order) { |
| | | //当前时间 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | |
| | | //最后消费时间 |
| | | LocalDateTime receiveTime = order.getReceiveTime(); |
| | | |
| | | // 将时间转换为LocalDate,只保留年月日部分 |
| | | LocalDate nowDate = now.toLocalDate(); |
| | | LocalDate receiveTimeDate = receiveTime.toLocalDate(); |
| | | long daysBetween = ChronoUnit.DAYS.between(receiveTimeDate, nowDate); |
| | | |
| | | if (daysBetween > 30 && daysBetween <= 90) { |
| | | GrowthValueDeductionStrategy growthInfo = growthValueStrategyContext.getGrowthInfo("SecondDeduction"); |
| | | growthInfo.deduct(order); |
| | | } else if (daysBetween > 90) { |
| | | GrowthValueDeductionStrategy growthInfo = growthValueStrategyContext.getGrowthInfo("ThirdDeduction"); |
| | | growthInfo.deduct(order); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.menber.impl; |
| | | |
| | | import com.mzl.flower.service.menber.GrowthValueDeductionStrategy; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | | public class GrowthValueStrategyContext { |
| | | @Autowired |
| | | private final Map<String, GrowthValueDeductionStrategy> growthValueDeductionStrategyMap = new HashMap<>(); |
| | | |
| | | public GrowthValueStrategyContext(Map<String, GrowthValueDeductionStrategy> growthValueDeductionStrategyMap) { |
| | | this.growthValueDeductionStrategyMap.clear(); |
| | | growthValueDeductionStrategyMap.forEach((k, v) -> this.growthValueDeductionStrategyMap.put(k, v)); |
| | | } |
| | | |
| | | public GrowthValueDeductionStrategy getGrowthInfo(String growthInfo) { |
| | | return growthValueDeductionStrategyMap.get(growthInfo); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.menber.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.request.menber.*; |
| | | import com.mzl.flower.dto.response.customer.CustomerDTO; |
| | | import com.mzl.flower.dto.response.member.MemberGrowthRecordVO; |
| | | import com.mzl.flower.dto.response.member.UserGrowthRecordVO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.entity.menber.MemberGrowthRecord; |
| | | import com.mzl.flower.entity.payment.Order; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.mapper.member.MemberGrowthRecordMapper; |
| | | import com.mzl.flower.mapper.member.MemberMapper; |
| | | import com.mzl.flower.service.menber.MemberGrowthRecordService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className MemberGrowthRecordServiceImpl |
| | | * @date 2024/8/26 |
| | | * @description 会员记录功能逻辑层 |
| | | */ |
| | | @Service |
| | | @Transactional |
| | | @RequiredArgsConstructor |
| | | public class MemberGrowthRecordServiceImpl extends ServiceImpl<MemberGrowthRecordMapper, MemberGrowthRecord> implements MemberGrowthRecordService { |
| | | |
| | | private final MemberGrowthRecordMapper memberGrowthRecordMapper; |
| | | |
| | | private final MemberMapper memberMapper; |
| | | |
| | | private final CustomerMapper customerMapper; |
| | | |
| | | |
| | | @Override |
| | | public void saveMemberGrowthRecord(MemberGrowthRecordDTO memberGrowthRecordDTO) { |
| | | if (StringUtils.isEmpty(memberGrowthRecordDTO.getUserId())) { |
| | | throw new ValidationException("用户ID不能为空"); |
| | | } |
| | | |
| | | MemberGrowthRecord memberGrowthRecord = new MemberGrowthRecord(); |
| | | BeanUtils.copyProperties(memberGrowthRecordDTO, memberGrowthRecord); |
| | | memberGrowthRecord.create(SecurityUtils.getUserId()); |
| | | memberGrowthRecord.setRecordDate(new Date()); |
| | | |
| | | CustomerDTO customerDTO = customerMapper.getCurrentCustomer(memberGrowthRecord.getUserId()); |
| | | if (ObjectUtils.isEmpty(customerDTO)) { |
| | | throw new ValidationException("人员信息为空"); |
| | | } |
| | | |
| | | Customer customer = customerMapper.selectById(customerDTO.getId()); |
| | | if (ObjectUtils.isEmpty(customer)) { |
| | | throw new ValidationException("人员信息为空"); |
| | | } |
| | | Member memberBefore = memberMapper.selectById(customer.getLevelId()); |
| | | if(ObjectUtils.isEmpty(memberBefore)){ |
| | | throw new ValidationException("人员对应的会员等级不存在,请联系管理员"); |
| | | } |
| | | |
| | | //保存会员记录逻辑: |
| | | if (Constants.GROWTH_SOURCE.consume.name().equals(memberGrowthRecordDTO.getSource())) { |
| | | //消费:成长值=消费金额/消费金额(元)*已消费产生的成长值C |
| | | BigDecimal totalAmount = memberGrowthRecordDTO.getTotalAmount(); |
| | | int consumptionAmount = memberBefore.getConsumptionAmount(); |
| | | int growthValue = memberBefore.getGrowthValue(); |
| | | BigDecimal actualGrowthValue = totalAmount.divide(new BigDecimal(consumptionAmount), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(growthValue)); |
| | | int growth = actualGrowthValue.setScale(0, BigDecimal.ROUND_HALF_UP).intValue(); // 四舍五入取整 |
| | | memberGrowthRecord.setGrowth(growth); |
| | | memberGrowthRecord.setType(Constants.GROWTH_TYPE.add.name()); |
| | | } |
| | | memberGrowthRecordMapper.insert(memberGrowthRecord); |
| | | |
| | | //会员等级同步逻辑: |
| | | Member memberAfter = getMemberByUserId(memberGrowthRecord.getUserId()); |
| | | customer.setLevelId(memberAfter.getId()); |
| | | customerMapper.updateById(customer); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询当前人员的成长值 最少是0 |
| | | * |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Member getMemberByUserId(String userId) { |
| | | if (StringUtils.isEmpty(userId)) { |
| | | throw new ValidationException("用户ID不能为空"); |
| | | } |
| | | Integer sumGrowth = memberGrowthRecordMapper.getSumGrowthByUsertId(userId); |
| | | |
| | | //查询当前会员等级 |
| | | Member member = memberMapper.getMemberByGrowthValue(sumGrowth); |
| | | if (ObjectUtils.isEmpty(member)) { |
| | | throw new ValidationException("会员信息为空"); |
| | | } |
| | | return member; |
| | | } |
| | | |
| | | @Override |
| | | public void updateMemberGrowthRecord(MemberGrowthRecordDTO memberGrowthRecordDTO) { |
| | | MemberGrowthRecord memberGrowthRecord = memberGrowthRecordMapper.selectById(memberGrowthRecordDTO.getId()); |
| | | if (memberGrowthRecord == null) { |
| | | throw new ValidationException("成长记录信息不存在"); |
| | | } |
| | | BeanUtils.copyProperties(memberGrowthRecordDTO, memberGrowthRecord); |
| | | memberGrowthRecord.update(SecurityUtils.getUserId()); |
| | | memberGrowthRecordMapper.updateById(memberGrowthRecord); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteMemberGrowthRecord(String id) { |
| | | MemberGrowthRecord memberGrowthRecord = memberGrowthRecordMapper.selectById(id); |
| | | if (memberGrowthRecord == null) { |
| | | throw new ValidationException("成长记录信息不存在"); |
| | | } |
| | | memberGrowthRecordMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public UserGrowthRecordDTO getInfoByUserId(String userId) { |
| | | UserGrowthRecordDTO userGrowthRecordDTO = new UserGrowthRecordDTO(); |
| | | List<TargetMemberDTO> targetMemberDTOList = new ArrayList<>(); |
| | | //查询当前人员的成长值 最少是0 |
| | | Integer sumGrowth = memberGrowthRecordMapper.getSumGrowthByUsertId(userId); |
| | | userGrowthRecordDTO.setCurrentGrowthValue(sumGrowth); |
| | | //查询当前会员等级 |
| | | Member member = new Member(); |
| | | member = memberMapper.getMemberByGrowthValue(sumGrowth); |
| | | if (ObjectUtils.isEmpty(member)) { |
| | | member = memberMapper.selectById(Constants.DEFAULT_MEMBER_ID); |
| | | } |
| | | userGrowthRecordDTO.setCurrentMemberLevel(member.getName()); |
| | | userGrowthRecordDTO.setCurrentDiscountType(member.getDiscountType()); |
| | | switch (member.getDiscountType()) { |
| | | case "ratio": |
| | | userGrowthRecordDTO.setCurrentDiscountTypeStr(Constants.DISCOUNT_TYPE.ratio.getDesc()); |
| | | break; |
| | | case "amount": |
| | | userGrowthRecordDTO.setCurrentDiscountTypeStr(Constants.DISCOUNT_TYPE.amount.getDesc()); |
| | | break; |
| | | } |
| | | userGrowthRecordDTO.setCurrentDiscountRatio(StringUtils.isEmpty(member.getDiscountRatio()) ? BigDecimal.valueOf(100) : member.getDiscountRatio()); |
| | | userGrowthRecordDTO.setCurrentDiscountAmount(StringUtils.isEmpty(member.getDiscountAmount()) ? BigDecimal.ZERO : member.getDiscountAmount()); |
| | | //查询比当前等级高的会员等级信息 |
| | | List<Member> memberList = memberMapper.getgtMembersByGrowthValue(sumGrowth); |
| | | if (!CollectionUtils.isEmpty(memberList)) { |
| | | memberList.forEach(m -> { |
| | | TargetMemberDTO targetMemberDTO = new TargetMemberDTO(); |
| | | targetMemberDTO.setTargetMemberLevel(m.getName()); |
| | | targetMemberDTO.setTargetStartPoint(m.getStartPoint()); |
| | | targetMemberDTO.setTargetGap(m.getStartPoint() - sumGrowth); |
| | | targetMemberDTO.setTargetDiscountAmount(StringUtils.isEmpty(m.getDiscountAmount()) ? BigDecimal.ZERO : m.getDiscountAmount()); |
| | | targetMemberDTO.setTargetDiscountType(m.getDiscountType()); |
| | | switch (m.getDiscountType()) { |
| | | case "ratio": |
| | | targetMemberDTO.setTargetDiscountTypeStr(Constants.DISCOUNT_TYPE.ratio.getDesc()); |
| | | break; |
| | | case "amount": |
| | | targetMemberDTO.setTargetDiscountTypeStr(Constants.DISCOUNT_TYPE.amount.getDesc()); |
| | | break; |
| | | } |
| | | targetMemberDTO.setTargetDiscountRatio(StringUtils.isEmpty(m.getDiscountRatio()) ? BigDecimal.valueOf(100) : m.getDiscountRatio()); |
| | | targetMemberDTOList.add(targetMemberDTO); |
| | | }); |
| | | } |
| | | userGrowthRecordDTO.setTargetMemberInfos(targetMemberDTOList); |
| | | |
| | | return userGrowthRecordDTO; |
| | | } |
| | | |
| | | @Override |
| | | public Page<MemberGrowthRecordVO> queryPage(MemberRecordQueryDTO memberRecordQueryDTO, Page page) { |
| | | List<MemberGrowthRecordVO> list = memberGrowthRecordMapper.queryPage(memberRecordQueryDTO, page); |
| | | page.setRecords(list); |
| | | return page; |
| | | } |
| | | |
| | | @Override |
| | | public void growthValueDeduct(Order order) { |
| | | //超过30天不到90天,每天处理当前会员等级的成长值 |
| | | CustomerDTO customerDTO = customerMapper.getCurrentCustomer(order.getCreateBy()); |
| | | Customer customer = customerMapper.selectById(customerDTO.getId()); |
| | | Member member = memberMapper.selectById(customer.getLevelId()); |
| | | if(ObjectUtils.isEmpty(member)){ |
| | | throw new ValidationException("用户会员等级未维护"); |
| | | } |
| | | int deductGrowthValue = member.getDowngradeValue(); |
| | | Integer sumGrowthByUserId = memberGrowthRecordMapper.getSumGrowthByUsertId(order.getCreateBy()); |
| | | |
| | | //当前成长值如果是等于0不需要走扣除逻辑 |
| | | if (sumGrowthByUserId != 0) { |
| | | int waitDeductGrowthValue = 0; |
| | | |
| | | //判断当前用户的成长值是够扣除,如果够扣除直接减去成长值,如果不够扣除则全部减去 |
| | | if (sumGrowthByUserId - deductGrowthValue > 0) { |
| | | waitDeductGrowthValue = deductGrowthValue; |
| | | } else { |
| | | waitDeductGrowthValue = sumGrowthByUserId; |
| | | } |
| | | |
| | | //保存会员成长记录到记录表 |
| | | MemberGrowthRecordDTO memberGrowthRecordDTO = new MemberGrowthRecordDTO(); |
| | | memberGrowthRecordDTO.setUserId(order.getCreateBy()); |
| | | memberGrowthRecordDTO.setRecordDate(new Date()); |
| | | memberGrowthRecordDTO.setGrowth(-waitDeductGrowthValue); |
| | | memberGrowthRecordDTO.setSource(Constants.GROWTH_SOURCE.downgrading.name()); |
| | | memberGrowthRecordDTO.setType(Constants.GROWTH_TYPE.reduce.name()); |
| | | memberGrowthRecordDTO.setRemarks("自动扣除"); |
| | | saveMemberGrowthRecord(memberGrowthRecordDTO); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Page<UserGrowthRecordVO> queryUserPage(UserMemberRecordQueryDTO userMemberRecordQueryDTO, Page page) { |
| | | List<UserGrowthRecordVO> list = memberGrowthRecordMapper.queryUserPage(userMemberRecordQueryDTO, page); |
| | | page.setRecords(list); |
| | | return page; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.menber.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.request.menber.MemberDTO; |
| | | import com.mzl.flower.dto.request.menber.MemberQueryDTO; |
| | | import com.mzl.flower.dto.response.member.MemberVO; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.mapper.member.MemberMapper; |
| | | import com.mzl.flower.service.menber.MemberService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className MemberServiceImpl |
| | | * @date 2024/8/26 |
| | | * @description 会员管理功能逻辑层 |
| | | */ |
| | | @Service |
| | | @Transactional |
| | | @RequiredArgsConstructor |
| | | public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> implements MemberService { |
| | | |
| | | private final MemberMapper memberMapper; |
| | | |
| | | private final CustomerMapper customerMapper; |
| | | |
| | | @Override |
| | | public void saveMember(MemberDTO memberDTO) { |
| | | //是否已经存在endpoint已经有最大值了,有的话需要删除或者修改 |
| | | if (memberDTO.getEndPoint() == null) { |
| | | // Member pointByIntegerMaxValue = memberMapper.getEndPointByIntegerMaxValue(Integer.MAX_VALUE); |
| | | // if (!ObjectUtils.isEmpty(pointByIntegerMaxValue)) { |
| | | // throw new ValidationException("系统中已经有一条最大值或者空值记录,请删除或者修改再保存"); |
| | | // } else { |
| | | memberDTO.setEndPoint(Integer.MAX_VALUE); |
| | | // } |
| | | } |
| | | if (StringUtils.isEmpty(memberDTO.getName())) { |
| | | throw new ValidationException("会员等级名称不能为空"); |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(memberDTO.getDiscountType())) { |
| | | throw new ValidationException("会员折扣类型不能为空"); |
| | | } |
| | | if (Constants.DISCOUNT_TYPE.amount.name().equals(memberDTO.getDiscountType()) && StringUtils.isEmpty(memberDTO.getDiscountAmount())) { |
| | | throw new ValidationException("会员折扣固定金额不能为空"); |
| | | } |
| | | if (Constants.DISCOUNT_TYPE.ratio.name().equals(memberDTO.getDiscountType()) && StringUtils.isEmpty(memberDTO.getDiscountRatio())) { |
| | | throw new ValidationException("会员折扣百分比不能为空"); |
| | | } |
| | | |
| | | if (memberDTO.getStartPoint() > memberDTO.getEndPoint()) { |
| | | throw new ValidationException("成长点开始不能大于结束点"); |
| | | } |
| | | if (!StringUtils.isEmpty(memberDTO.getDiscountRatio())) { |
| | | int discountRatio1 = memberDTO.getDiscountRatio().compareTo(BigDecimal.ZERO); |
| | | if (discountRatio1 == -1) { |
| | | throw new ValidationException("会员折扣百分比不能小于0"); |
| | | } |
| | | int discountRatio2 = memberDTO.getDiscountRatio().compareTo(new BigDecimal(100)); |
| | | if (discountRatio2 == 1) { |
| | | throw new ValidationException("会员折扣百分比不能大于100"); |
| | | } |
| | | } |
| | | //区间交集判断 |
| | | //查询所有等级 |
| | | List<Member> allMember = memberMapper.getAllMember(); |
| | | allMember.forEach(a -> { |
| | | if (a.getStartPoint() < memberDTO.getEndPoint() && a.getEndPoint() > memberDTO.getStartPoint()) { |
| | | throw new ValidationException("存在交集,不允许保存"); |
| | | } |
| | | }); |
| | | if (!StringUtils.isEmpty(memberDTO.getDiscountAmount())) { |
| | | int discountAmount = memberDTO.getDiscountAmount().compareTo(BigDecimal.ZERO); |
| | | if (discountAmount == -1) { |
| | | throw new ValidationException("会员折扣固定金额不能小于0"); |
| | | } |
| | | } |
| | | |
| | | //保存时判断是否有重复的名称 |
| | | Member memberByName = memberMapper.getMemberByName(memberDTO.getName()); |
| | | if (!ObjectUtils.isEmpty(memberByName)) { |
| | | throw new ValidationException("会员等级名称重复"); |
| | | } |
| | | Member member = new Member(); |
| | | BeanUtils.copyProperties(memberDTO, member); |
| | | member.create(SecurityUtils.getUserId()); |
| | | memberMapper.insert(member); |
| | | //更新会员等级 |
| | | customerMapper.updateMemberLevelByPoint(member.getId(), member.getStartPoint(), member.getEndPoint()); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void updateMember(MemberDTO memberDTO) { |
| | | Member memberInfo = memberMapper.selectById(memberDTO.getId()); |
| | | if (memberInfo == null) { |
| | | throw new ValidationException("会员等级信息不存在"); |
| | | } |
| | | if (StringUtils.isEmpty(memberDTO.getDiscountType())) { |
| | | throw new ValidationException("会员折扣类型不能为空"); |
| | | } |
| | | if (Constants.DISCOUNT_TYPE.amount.name().equals(memberDTO.getDiscountType()) && StringUtils.isEmpty(memberDTO.getDiscountAmount())) { |
| | | throw new ValidationException("会员折扣固定金额不能为空"); |
| | | } |
| | | if (Constants.DISCOUNT_TYPE.ratio.name().equals(memberDTO.getDiscountType()) && StringUtils.isEmpty(memberDTO.getDiscountRatio())) { |
| | | throw new ValidationException("会员折扣百分比不能为空"); |
| | | } |
| | | if (!StringUtils.isEmpty(memberDTO.getDiscountRatio())) { |
| | | int discountRatio1 = memberDTO.getDiscountRatio().compareTo(BigDecimal.ZERO); |
| | | if (discountRatio1 == -1) { |
| | | throw new ValidationException("会员折扣百分比不能小于0"); |
| | | } |
| | | int discountRatio2 = memberDTO.getDiscountRatio().compareTo(new BigDecimal(100)); |
| | | if (discountRatio2 == 1) { |
| | | throw new ValidationException("会员折扣百分比不能大于100"); |
| | | } |
| | | } |
| | | if (!StringUtils.isEmpty(memberDTO.getDiscountAmount())) { |
| | | int discountAmount = memberDTO.getDiscountAmount().compareTo(BigDecimal.ZERO); |
| | | if (discountAmount == -1) { |
| | | throw new ValidationException("会员折扣固定金额不能小于0"); |
| | | } |
| | | } |
| | | Member memberTemp = memberMapper.getMemberByName(memberDTO.getName()); |
| | | //判断如果按照会员等级查询到得名称和当前得Id不一致,不能修改。 |
| | | if (!ObjectUtils.isEmpty(memberTemp)) { |
| | | if (memberTemp.getId() != memberDTO.getId()) { |
| | | throw new ValidationException("已存在会员等级名称,无法修改"); |
| | | } |
| | | } |
| | | //是否已经存在endpoint已经有最大值了,有的话需要删除或者修改 |
| | | // if (memberDTO.getEndPoint() == null && memberInfo.getEndPoint() != Integer.MAX_VALUE) { |
| | | // Member pointByIntegerMaxValue = memberMapper.getEndPointByIntegerMaxValue(Integer.MAX_VALUE); |
| | | // if (!ObjectUtils.isEmpty(pointByIntegerMaxValue)) { |
| | | // throw new ValidationException("系统中已经有一条最大值或者空值记录,请删除或者修改再保存"); |
| | | // } else { |
| | | // memberDTO.setEndPoint(Integer.MAX_VALUE); |
| | | // } |
| | | // } else if (memberDTO.getEndPoint() == null && memberInfo.getEndPoint() == Integer.MAX_VALUE) { |
| | | // memberDTO.setEndPoint(Integer.MAX_VALUE); |
| | | // } |
| | | |
| | | if (memberDTO.getEndPoint() == null) { |
| | | if (memberInfo.getEndPoint() != Integer.MAX_VALUE) { |
| | | Member pointByIntegerMaxValue = memberMapper.getEndPointByIntegerMaxValue(Integer.MAX_VALUE); |
| | | if (!ObjectUtils.isEmpty(pointByIntegerMaxValue)) { |
| | | throw new ValidationException("系统中已经有一条最大值或者空值记录,请删除或者修改再保存"); |
| | | } else { |
| | | memberDTO.setEndPoint(Integer.MAX_VALUE); |
| | | } |
| | | } else { |
| | | memberDTO.setEndPoint(Integer.MAX_VALUE); |
| | | } |
| | | } |
| | | |
| | | if (memberDTO.getStartPoint() > memberDTO.getEndPoint()) { |
| | | throw new ValidationException("成长点开始不能大于结束"); |
| | | } |
| | | //区间交集判断 |
| | | //查询所有等级 |
| | | List<Member> allMember = memberMapper.getOtherAllMember(memberDTO.getId()); |
| | | allMember.forEach(a -> { |
| | | if (a.getStartPoint() < memberDTO.getEndPoint() && a.getEndPoint() > memberDTO.getStartPoint()) { |
| | | throw new ValidationException("存在交集,不允许修改"); |
| | | } |
| | | }); |
| | | |
| | | //更新会员等级 |
| | | if (memberInfo.getStartPoint() != memberDTO.getStartPoint() || memberInfo.getEndPoint() != memberDTO.getEndPoint()) { |
| | | customerMapper.updateMemberLevelByPoint(memberInfo.getId(), memberInfo.getStartPoint(), memberInfo.getEndPoint()); |
| | | } |
| | | |
| | | BeanUtils.copyProperties(memberDTO,memberInfo); |
| | | memberInfo.update(SecurityUtils.getUserId()); |
| | | memberMapper.updateById(memberInfo); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void deleteMember(String id) { |
| | | if(id.equals(Constants.DEFAULT_MEMBER_ID)){ |
| | | throw new ValidationException("默认普通会员只能编辑,不能删除"); |
| | | } |
| | | Member member = memberMapper.selectById(id); |
| | | if (member == null) { |
| | | throw new ValidationException("会员等级信息不存在"); |
| | | } |
| | | Integer levelId = customerMapper.getByLevelId(id); |
| | | if (levelId > 0) { |
| | | throw new ValidationException("当前会员等级用户已使用,无法删除"); |
| | | } |
| | | memberMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public Page<MemberVO> queryPage(MemberQueryDTO memberQueryDTO, Page page) { |
| | | List<MemberVO> list = memberMapper.queryPage(memberQueryDTO, page); |
| | | page.setRecords(list); |
| | | return page; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.menber.impl; |
| | | |
| | | import com.mzl.flower.entity.payment.Order; |
| | | import com.mzl.flower.service.menber.GrowthValueDeductionStrategy; |
| | | import com.mzl.flower.service.menber.MemberGrowthRecordService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * packageName com.mzl.flower.service.menber.impl |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className SecondDeductionStrategy |
| | | * @date 2024/9/2 |
| | | * @description TODO |
| | | */ |
| | | @Transactional |
| | | @RequiredArgsConstructor |
| | | @Service("SecondDeduction") |
| | | public class SecondDeductionStrategy implements GrowthValueDeductionStrategy { |
| | | |
| | | private final MemberGrowthRecordService memberGrowthRecordService; |
| | | |
| | | @Override |
| | | public void deduct(Order order) { |
| | | memberGrowthRecordService.growthValueDeduct(order); |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.menber.impl; |
| | | |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.request.menber.MemberGrowthRecordDTO; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.entity.menber.MemberDowngradeRecord; |
| | | import com.mzl.flower.entity.payment.Order; |
| | | import com.mzl.flower.mapper.member.MemberDowngradeRecordMapper; |
| | | import com.mzl.flower.mapper.member.MemberGrowthRecordMapper; |
| | | import com.mzl.flower.mapper.member.MemberMapper; |
| | | import com.mzl.flower.service.menber.GrowthValueDeductionStrategy; |
| | | import com.mzl.flower.service.menber.MemberGrowthRecordService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * packageName com.mzl.flower.service.menber.impl |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className ThirdDeductionStrategy |
| | | * @date 2024/9/2 |
| | | * @description TODO |
| | | */ |
| | | @Transactional |
| | | @RequiredArgsConstructor |
| | | @Service("ThirdDeduction") |
| | | public class ThirdDeductionStrategy implements GrowthValueDeductionStrategy { |
| | | |
| | | private final MemberDowngradeRecordMapper memberDowngradeRecordMapper; |
| | | private final MemberGrowthRecordService memberGrowthRecordService; |
| | | private final MemberGrowthRecordMapper memberGrowthRecordMapper; |
| | | |
| | | private final MemberMapper memberMapper; |
| | | |
| | | @Override |
| | | public void deduct(Order order) { |
| | | LocalDate nowDate = LocalDateTime.now().toLocalDate(); |
| | | LocalDate receiveTimeDate = order.getReceiveTime().toLocalDate(); |
| | | long daysBetween = ChronoUnit.DAYS.between(receiveTimeDate, nowDate); |
| | | //判断是否有会员降级记录 |
| | | Integer countByUserId = memberDowngradeRecordMapper.getMemberByName(order.getCreateBy()); |
| | | int day = (int) (daysBetween - countByUserId * 90); |
| | | //扣除记录数*90 |
| | | //0-90;1-180;2-270 |
| | | if (countByUserId == 0 || day > 90) { |
| | | //保存会员降级记录 |
| | | Member member = memberGrowthRecordService.getMemberByUserId(order.getCreateBy()); |
| | | MemberDowngradeRecord memberDowngradeRecord = new MemberDowngradeRecord(); |
| | | memberDowngradeRecord.setUserId(order.getCreateBy()); |
| | | memberDowngradeRecord.setMemberId(member.getId()); |
| | | memberDowngradeRecord.setMemberName(member.getName()); |
| | | memberDowngradeRecord.create(); |
| | | memberDowngradeRecordMapper.insert(memberDowngradeRecord); |
| | | |
| | | //统计当前人员现有成长值 |
| | | Integer sumGrowthByUserId = memberGrowthRecordMapper.getSumGrowthByUsertId(order.getCreateBy()); |
| | | |
| | | //当前人员需要降到的成长值 |
| | | Member targetMember = memberMapper.getgtMembersByEndPoint(sumGrowthByUserId); |
| | | if (!ObjectUtils.isEmpty(targetMember)) { |
| | | //有降级目标 |
| | | int targetGrowth = targetMember.getEndPoint() - 1; |
| | | //需要降级扣除的成长值是目标值减去当前值 |
| | | int needDeductGrowthValue = targetGrowth-sumGrowthByUserId; |
| | | //保存会员成长记录到记录表 |
| | | MemberGrowthRecordDTO memberGrowthRecordDTO = new MemberGrowthRecordDTO(); |
| | | memberGrowthRecordDTO.setUserId(order.getCreateBy()); |
| | | memberGrowthRecordDTO.setRecordDate(new Date()); |
| | | memberGrowthRecordDTO.setGrowth(needDeductGrowthValue); |
| | | memberGrowthRecordDTO.setSource(Constants.GROWTH_SOURCE.downgrading.name()); |
| | | memberGrowthRecordDTO.setType(Constants.GROWTH_TYPE.reduce.name()); |
| | | memberGrowthRecordDTO.setRemarks("自动降级"); |
| | | memberGrowthRecordService.saveMemberGrowthRecord(memberGrowthRecordDTO); |
| | | } else { |
| | | memberGrowthRecordService.growthValueDeduct(order); |
| | | } |
| | | } else if (countByUserId > 0) { |
| | | if (day > 30 && day <= 90) { |
| | | memberGrowthRecordService.growthValueDeduct(order); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | private OrderItemSalesMapper orderItemSalesMapper; |
| | | |
| | | @Autowired |
| | | private OrderItemSettlementMapper orderItemSettlementMapper; |
| | | |
| | | public Page<BillListDTO> selectBillList(Page page, BillQueryDTO dto){ |
| | | dto.setStart(parseLocalDate(dto.getStartDate())); |
| | | dto.setEnd(parseLocalDate(dto.getEndDate())); |
| | |
| | | r.setDeductAmount(r.getDeductAmount().add(b.getDeductAmount())); |
| | | r.setSalesAmount(r.getSalesAmount().add(b.getSalesAmount())); |
| | | r.setProfitAmount(r.getProfitAmount().add(b.getProfitAmount())); |
| | | r.setMemberCouponAmount(r.getMemberCouponAmount().add(b.getMemberCouponAmount())); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | //账单售后 |
| | | List<OrderItemSales> sLs = orderItemSalesMapper.selectList(new QueryWrapper<OrderItemSales>() |
| | | /*List<OrderItemSales> sLs = orderItemSalesMapper.selectList(new QueryWrapper<OrderItemSales>() |
| | | .in("order_id", orderIdsAll));*/ |
| | | List<OrderItemSettlement> sLs = orderItemSettlementMapper.selectList(new QueryWrapper<OrderItemSettlement>() |
| | | .in("order_id", orderIdsAll)); |
| | | Map<String, BigDecimal> salesMap = new HashMap<>(); |
| | | Map<String, BigDecimal> deductMap = new HashMap<>(); |
| | | if(sLs != null && sLs.size() > 0){ |
| | | for(OrderItemSales s : sLs){//同一个订单的同一个商品可能会多次理赔 |
| | | prepareSalesAmount(s, null, null, salesMap); |
| | | for(OrderItemSettlement s : sLs){//同一个订单的同一个商品可能会多次理赔 |
| | | salesMap.put(s.getOrderItemId(), s.getSalesFeePlatform()); |
| | | deductMap.put(s.getOrderItemId(), s.getLackFeePlatform()); |
| | | } |
| | | } |
| | | |
| | | |
| | | String type = Constants.BILL_TYPE.partner.name();//账单类型 |
| | | calculate(date, type, orderIdsPartner, orderMap, orderItemMap, salesMap); |
| | | calculate(date, type, orderIdsPartner, orderMap, orderItemMap, salesMap, deductMap); |
| | | |
| | | type = Constants.BILL_TYPE.personal.name();//账单类型 |
| | | calculate(date, type, orderIdsPersonal, orderMap, orderItemMap, salesMap); |
| | | calculate(date, type, orderIdsPersonal, orderMap, orderItemMap, salesMap, deductMap); |
| | | } |
| | | |
| | | public Bill calculate(LocalDate date, String type, List<String> orderIds, Map<String, Order> orderMap |
| | | , Map<String, List<OrderItem>> orderItemMap, Map<String, BigDecimal> salesMap){ |
| | | , Map<String, List<OrderItem>> orderItemMap, Map<String, BigDecimal> salesMap |
| | | , Map<String, BigDecimal> deductMap){ |
| | | Bill bill = new Bill(); |
| | | bill.setId(UUIDGenerator.getUUID()); |
| | | |
| | |
| | | BigDecimal markupOne = new BigDecimal(0);//区间加价 |
| | | BigDecimal markupTwo = new BigDecimal(0);//二次加价 |
| | | BigDecimal markupPartner = new BigDecimal(0);//合伙人加价 |
| | | BigDecimal deductAmount = new BigDecimal(0);//质检退款 |
| | | BigDecimal deductAmount = new BigDecimal(0);//质检退款(缺货) |
| | | BigDecimal salesAmount = new BigDecimal(0);//售后退款 |
| | | BigDecimal memberCouponAmount = new BigDecimal(0);//优惠券金额 |
| | | for(String orderId : orderIds){ |
| | | Order o = orderMap.get(orderId); |
| | | orderAmount = orderAmount.add(o.getTotalAmount()); |
| | |
| | | for(OrderItem oi : items){ |
| | | Integer n = oi.getNum(); |
| | | supplierAmount = supplierAmount.add(oi.getSupplierPrice().multiply(new BigDecimal(n))); |
| | | markupOne = markupOne.add(oi.getMarkupOne().multiply(new BigDecimal(n))); |
| | | markupTwo = markupTwo.add((oi.getMarkupTwo() == null ? new BigDecimal(0) : oi.getMarkupTwo()).multiply(new BigDecimal(n))); |
| | | markupPartner = markupPartner.add((oi.getMarkupPartner() == null ? new BigDecimal(0) : oi.getMarkupPartner()).multiply(new BigDecimal(n))); |
| | | deductAmount = deductAmount.add(oi.getDeductAmount() == null ? new BigDecimal(0) : oi.getDeductAmount()); |
| | | markupOne = markupOne.add(getAmount(oi.getMarkupOne()).multiply(new BigDecimal(n))); |
| | | markupTwo = markupTwo.add(getAmount(oi.getMarkupTwo()).multiply(new BigDecimal(n))); |
| | | markupPartner = markupPartner.add(getAmount(oi.getMarkupPartner()).multiply(new BigDecimal(n))); |
| | | |
| | | salesAmount = salesAmount.add(getAmount(salesMap.get(oi.getId()))); |
| | | deductAmount = deductAmount.add(getAmount(deductMap.get(oi.getId()))); |
| | | num += n; |
| | | } |
| | | BigDecimal ss = salesMap.get(orderId); |
| | | salesAmount = salesAmount.add(ss == null ? new BigDecimal(0) : ss); |
| | | |
| | | memberCouponAmount = memberCouponAmount.add(getAmount(o.getMemberCouponAmount())); |
| | | |
| | | o.setBillId(bill.getId()); |
| | | orderMapper.updateById(o); |
| | |
| | | bill.setMarkupPartner(markupPartner); |
| | | bill.setDeductAmount(deductAmount); |
| | | bill.setSalesAmount(salesAmount); |
| | | bill.setMemberCouponAmount(memberCouponAmount); |
| | | bill.setBillDate(date); |
| | | |
| | | //合伙人:利润=售价-底价(花农上架价格)-打包、运费(订单管理手输)-合伙人加价-平台罚款 |
| | | //散户:利润=售价-底价(花农上架价格)-运费-平台罚款 |
| | | //合伙人:利润=售价-底价(花农上架价格)-打包、运费(订单管理手输)-合伙人加价-平台罚款-质检(缺货)-优惠券 |
| | | //散户:利润=售价-底价(花农上架价格)-运费-平台罚款-质检(缺货)-优惠券 |
| | | //其实都一样的计算方式 |
| | | BigDecimal profitAmount = orderAmount.subtract(supplierAmount) |
| | | .subtract(markupPartner).subtract(salesAmount).subtract(packingFee).subtract(transportFee);//利润合计 |
| | | .subtract(markupPartner).subtract(salesAmount).subtract(packingFee).subtract(transportFee) |
| | | .subtract(deductAmount).subtract(memberCouponAmount);//利润合计 |
| | | bill.setProfitAmount(profitAmount); |
| | | |
| | | bill.create(); |
| | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.time.temporal.ChronoUnit; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | } |
| | | |
| | | public Page<DeliveryOrderStatisticsDTO> selectSupplierDoStatistics(Page page){ |
| | | |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); |
| | | LocalDate theDay = parseLocalDate("2024-08-03"); |
| | | |
| | | long current = page.getCurrent(); |
| | |
| | | current = current == 0 ? 1 : current; |
| | | |
| | | long endDays = (current - 1) * size; |
| | | long beginDays = endDays + size; |
| | | long beginDays = endDays + size-1; |
| | | LocalDate beginDate = now.plusDays(-beginDays); |
| | | LocalDate endDate = now.plusDays(-endDays); |
| | | |
| | |
| | | , fivePm.plusDays(-1), fivePm); |
| | | |
| | | DeliveryOrderStatisticsDTO dto = new DeliveryOrderStatisticsDTO(); |
| | | dto.setId(endDate.format(formatter)); |
| | | dto.setDate(endDate); |
| | | dto.setNum(0); |
| | | dto.setPrice(new BigDecimal(0)); |
| | |
| | | } |
| | | |
| | | page.setRecords(ls); |
| | | |
| | | |
| | | // 获取当前日期 |
| | | LocalDate today = LocalDate.now(); |
| | | // 计算当前日期与给定日期的天数差 |
| | | long daysBetween = ChronoUnit.DAYS.between(theDay, today); |
| | | page.setTotal(daysBetween); |
| | | |
| | | return page; |
| | | } |
| | | |
| | | public List<DeliveryOrderItemListDTO> getDeliveryOrderItems(String id) { |
| | | return deliveryOrderItemMapper.selectDoItemList(id); |
| | | } |
| | | |
| | | public List<DeliveryOrderItemDTO> getSupplierDeliveryOrderItems(PostQueryDTO dto){ |
| | | List<String> idList = dto.getIds(); |
| | | List<DeliveryOrderItemDTO> ls = new ArrayList<>(); |
| | | if(idList != null && idList.size() > 0){ |
| | | for(String id : idList){ |
| | | ls.add(getSupplierDeliveryOrderItem(id)); |
| | | } |
| | | } |
| | | |
| | | return ls; |
| | | } |
| | | |
| | | public DeliveryOrderItemDTO getSupplierDeliveryOrderItem(String id) { |
| | |
| | | |
| | | dto.setParams(parseArray(oi.getFlowerParams(), ParamItemDTO.class)); |
| | | |
| | | dto.setNum(oi.getNum()); |
| | | |
| | | return dto; |
| | | } |
| | | |
| | | public List<DeliveryOrderItemDTO> getDeliveryOrderItems(PostQueryDTO dto){ |
| | | List<String> idList = dto.getIds(); |
| | | List<DeliveryOrderItemDTO> ls = new ArrayList<>(); |
| | | if(idList != null && idList.size() > 0){ |
| | | for(String id : idList){ |
| | | ls.add(getDeliveryOrderItem(id)); |
| | | } |
| | | } |
| | | |
| | | return ls; |
| | | } |
| | | |
| | | public DeliveryOrderItemDTO getDeliveryOrderItem(String id) { |
| | |
| | | dto.setFlowerCategory(oi.getFlowerCategory()); |
| | | |
| | | dto.setParams(parseArray(oi.getFlowerParams(), ParamItemDTO.class)); |
| | | |
| | | dto.setNum(oi.getNum()); |
| | | |
| | | return dto; |
| | | } |
| | |
| | | ); |
| | | if (items != null && items.size() > 0) { |
| | | for (OrderItem i : items) { |
| | | i.setStatus(Constants.CHECK_OPERATE.ok.name()); |
| | | i.setStatus(Constants.ORDER_ITEM_STATUS.ok.name()); |
| | | i.setCheckTime(LocalDateTime.now()); |
| | | orderItemMapper.updateById(i); |
| | | } |
| | |
| | | ); |
| | | if (count == 0) { |
| | | Order o = orderMapper.selectById(orderId); |
| | | if(!Constants.ORDER_STATUS_BACKEND.COLLECTION.name().equals(o.getStatusBackend())){ |
| | | log.warn("非待集货状态,不可设置待发货"); |
| | | return; |
| | | } |
| | | o.setStatusBackend(Constants.ORDER_STATUS_BACKEND.SEND.name()); |
| | | o.update(SecurityUtils.getUserId()); |
| | | orderMapper.updateById(o); |
| | |
| | | } |
| | | |
| | | Integer orderCountToday = deliveryOrderMapper.selectCount(new QueryWrapper<DeliveryOrder>() |
| | | .eq("deleted", 0) |
| | | .eq("supplier_id", supplierId) |
| | | .gt("create_time", startDate) |
| | | .le("create_time", endDate)); |
| | | dto.setOrderCountToday(orderCountToday == null ? 0 : orderCountToday); |
| | | |
| | | Integer orderCountYesterday = deliveryOrderMapper.selectCount(new QueryWrapper<DeliveryOrder>() |
| | | .eq("deleted", 0) |
| | | .eq("supplier_id", supplierId) |
| | | .gt("create_time", startDate.plusDays(-1)) |
| | | .le("create_time", endDate.plusDays(-1))); |
| | |
| | | |
| | | LocalDateTime ffPm = LocalDate.now().withDayOfMonth(1).atTime(17, 0, 0).plusDays(-1); |
| | | Integer orderCountMonth = deliveryOrderMapper.selectCount(new QueryWrapper<DeliveryOrder>() |
| | | .eq("deleted", 0) |
| | | .eq("supplier_id", supplierId) |
| | | .gt("create_time", ffPm)); |
| | | dto.setOrderCountMonth(orderCountMonth == null ? 0 : orderCountMonth); |
| | | |
| | | BigDecimal salesRate = new BigDecimal(0); |
| | | Integer orderTotal = deliveryOrderMapper.selectCount(new QueryWrapper<DeliveryOrder>() |
| | | .eq("supplier_id", supplierId)); |
| | | .eq("deleted", 0) |
| | | .eq("supplier_id", supplierId) |
| | | ); |
| | | Integer salesCount = orderItemSalesMapper.getSupplierSalesCount(supplierId); |
| | | if (orderTotal != null && orderTotal > 0) { |
| | | BigDecimal rate = new BigDecimal(salesCount).divide(new BigDecimal(orderTotal), 2, RoundingMode.HALF_UP); |
| | |
| | | return dto; |
| | | } |
| | | |
| | | public List<StationStatisticDTO> statisticStationList(String name, LocalDateTime startDate, LocalDateTime endDate) { |
| | | public List<StationStatisticDTO> statisticStationList(String name, LocalDateTime startDate |
| | | , LocalDateTime endDate, String status) { |
| | | String userId = SecurityUtils.getUserId(); |
| | | LambdaQueryWrapper<Station> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.like(Station::getUserIds, userId); |
| | | lambdaQueryWrapper.like(Station::getUserIds, "%" + userId + "%"); |
| | | lambdaQueryWrapper.eq(Station::getType, "0"); |
| | | boolean hasZc = stationMapper.selectCount(lambdaQueryWrapper)>0;//当前用户是否有总仓权限,总仓能查看到所有集货站的数据 |
| | | boolean hasZc = stationMapper.selectCount(lambdaQueryWrapper) > 0;//当前用户是否有总仓权限,总仓能查看到所有集货站的数据 |
| | | List<String> statusList = splitParam(status); |
| | | if(hasZc){ |
| | | List<StationStatisticDTO> stationStatisticDTOS = deliveryOrderMapper.statisticStationList(startDate, endDate,name,null); |
| | | List<StationStatisticDTO> stationStatisticDTOS = deliveryOrderMapper.statisticStationList(startDate, endDate,name,null, statusList); |
| | | return stationStatisticDTOS; |
| | | }else{ |
| | | List<StationStatisticDTO> stationStatisticDTOS = deliveryOrderMapper.statisticStationList(startDate, endDate,name,userId); |
| | | List<StationStatisticDTO> stationStatisticDTOS = deliveryOrderMapper.statisticStationList(startDate, endDate, name, userId, statusList); |
| | | return stationStatisticDTOS; |
| | | } |
| | | } |
| | | |
| | | //////////////////////////////////////////////////////////////新接口 |
| | | public Page<DeliveryOrderList4CheckDTO> selectSupplierDoList4Check(Page page, DeliveryOrderStationQueryDTO dto) { |
| | | dto.setStatusList(splitParam(dto.getStatus())); |
| | | List<DeliveryOrderList4CheckDTO> ls = deliveryOrderMapper.selectSupplierDoList4Check(page, dto); |
| | | |
| | | page.setRecords(ls); |
| | |
| | | if(dto.getSupplierId() == null){ |
| | | throw new ValidationException("供应商id不能为空"); |
| | | } |
| | | dto.setStatusList(splitParam(dto.getStatus())); |
| | | List<DeliveryOrder4CheckDTO> ls = deliveryOrderMapper.selectSupplierDoInfo4Check(page, dto); |
| | | |
| | | if(ls != null && ls.size() > 0){ |
| | |
| | | return dto; |
| | | } |
| | | |
| | | public OrderItemCheckNumDTO getOtherCheck(String itemId, String type){ |
| | | public OrderItemCheckNumDTO getOtherCheck(String itemId, String type, boolean isSupplier){ |
| | | OrderItemCheck c = orderItemCheckMapper.selectOne(new QueryWrapper<OrderItemCheck>() |
| | | .eq("type", type) |
| | | .eq("order_item_id", itemId) |
| | |
| | | BeanUtils.copyProperties(c, dto); |
| | | User user = userMapper.selectById(c.getCreateBy()); |
| | | dto.setCreateName(user.getNickName()); |
| | | |
| | | if(Constants.CHECK_TYPE.lack.name().equals(c.getType()) && isSupplier){ |
| | | OrderItem oi = orderItemMapper.selectById(itemId); |
| | | BigDecimal lackFeeSupplier = oi.getSupplierPrice().multiply(new BigDecimal(c.getNum())); |
| | | dto.setDeductAmount(lackFeeSupplier); |
| | | } |
| | | } |
| | | |
| | | return dto; |
| | |
| | | } |
| | | |
| | | BigDecimal deduct = new BigDecimal(0); |
| | | BigDecimal realPrice = getAmount(oi.getRealPrice()); |
| | | if(Constants.CHECK_TYPE.replace.name().equals(dto.getType())){ |
| | | deduct = oi.getSupplierPrice().multiply(new BigDecimal(dto.getNum())); |
| | | } else if(Constants.CHECK_TYPE.lack.name().equals(dto.getType())){ |
| | | deduct = oi.getPrice().multiply(new BigDecimal(dto.getNum())); |
| | | deduct = realPrice.multiply(new BigDecimal(dto.getNum())); |
| | | //质检退款,按照这个单价扣,如果3扎都缺货,按照总的金额退 |
| | | //缺货数量等于商品总数时按真实总价退款 |
| | | if(dto.getNum().intValue() == oi.getNum() && oi.getRealTotal() != null){ |
| | | deduct = oi.getRealTotal(); |
| | | } |
| | | } else if (Constants.CHECK_TYPE.reduce.name().equals(dto.getType())) { |
| | | if(deductAmount == null){ |
| | | throw new ValidationException("降级金额不能为空"); |
| | | } |
| | | deduct = deductAmount.multiply(new BigDecimal(dto.getNum())); |
| | | BigDecimal dt = oi.getPrice().multiply(new BigDecimal(dto.getNum())); |
| | | if(deduct.doubleValue() > dt.doubleValue()){ |
| | | BigDecimal dt = realPrice.multiply(new BigDecimal(dto.getNum())); |
| | | if(deduct.doubleValue() > dt.doubleValue() |
| | | || (oi.getRealTotal() != null && deduct.doubleValue() > oi.getRealTotal().doubleValue())){ |
| | | throw new ValidationException("降级金额不能大于商品处理数量金额"); |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | private CodeDecorator codeDecorator; |
| | | |
| | | @Autowired |
| | | private OrderItemCheckMapper orderItemCheckMapper; |
| | | |
| | | public String createSales(OrderItemSalesCreateDTO dto){ |
| | | Integer num = dto.getNum(); |
| | | if(num == null || num == 0){ |
| | |
| | | throw new ValidationException("订单商品不存在"); |
| | | } |
| | | |
| | | if(num > oi.getNum()){ |
| | | OrderItemCheck c = orderItemCheckMapper.selectOne(new QueryWrapper<OrderItemCheck>() |
| | | .eq("order_item_id", oi.getId()) |
| | | .eq("type", Constants.CHECK_TYPE.lack.name()) |
| | | .eq("audit_status", Constants.CHECK_AUDIT_STATUS.AGREED.name()) |
| | | ); |
| | | int totalNum = oi.getNum(); |
| | | if(c != null){//需要减去缺货的数量 |
| | | totalNum -= c.getNum(); |
| | | } |
| | | if(num > totalNum){ |
| | | throw new ValidationException("申请数量不能超过总数"); |
| | | } |
| | | |
| | |
| | | int replaceNum = 0;//补货数量 |
| | | BigDecimal replaceFee = new BigDecimal(0);//补货扣款 |
| | | int lackNum = 0;//缺货数量 |
| | | BigDecimal lackFeeSupplier = new BigDecimal(0);//缺货扣款 |
| | | BigDecimal lackFeePartner = new BigDecimal(0);//缺货扣款 |
| | | BigDecimal lackFeePlatform = new BigDecimal(0);//缺货扣款 |
| | | BigDecimal lackFeeSupplier = new BigDecimal(0);//供应商缺货扣款 |
| | | BigDecimal lackFeePartner = new BigDecimal(0);//合伙人缺货扣款 |
| | | BigDecimal lackFeePlatform = new BigDecimal(0);//平台缺货扣款 |
| | | if (orderItemCheckList != null && orderItemCheckList.size() > 0) { |
| | | for (OrderItemCheck c : orderItemCheckList) { |
| | | Integer num = c.getNum(); |
| | |
| | | String type = c.getType(); |
| | | if (Constants.CHECK_TYPE.reduce.name().equals(type)) { |
| | | checkNum = num == null ? 0 : num; |
| | | checkFee = amount == null ? new BigDecimal(0) : amount; |
| | | checkFee = getAmount(amount); |
| | | } else if (Constants.CHECK_TYPE.lack.name().equals(type)) { |
| | | lackNum = num == null ? 0 : num; |
| | | lackFeeSupplier = oi.getSupplierPrice().multiply(new BigDecimal(lackNum)); |
| | |
| | | |
| | | BigDecimal markupOne = getAmount(oi.getMarkupOne()); |
| | | BigDecimal markupTwo = getAmount(oi.getMarkupTwo()); |
| | | lackFeePlatform = markupOne.multiply(new BigDecimal(lackNum)); |
| | | lackFeePlatform = lackFeePlatform.add(markupTwo.multiply(new BigDecimal(lackNum))); |
| | | BigDecimal ppPrice = markupOne.add(markupTwo).subtract(getAmount(oi.getCouponAmount()));//1次加价+2次加价-优惠券金额 |
| | | lackFeePlatform = lackFeePlatform.add(ppPrice.multiply(new BigDecimal(lackNum))); |
| | | } else if (Constants.CHECK_TYPE.replace.name().equals(type)) { |
| | | replaceNum = num == null ? 0 : num; |
| | | replaceFee = amount == null ? new BigDecimal(0) : amount; |
| | | replaceFee = getAmount(amount); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (serviceFeeRate == null) { |
| | | ois.setServiceFeeRate(getFeeRate(oi)); |
| | | } |
| | | ois.setServiceFee(getServiceFee(oi, replaceNum, lackNum, ois.getServiceFeeRate())); |
| | | ois.setServiceFee(getServiceFee(oi, replaceNum, lackNum, ois.getServiceFeeRate()));//服务费 |
| | | |
| | | ois.setStationFee(getStationFee(oi, replaceNum, lackNum)); |
| | | ois.setStationFee(getStationFee(oi, replaceNum, lackNum));//集货站运费 |
| | | } |
| | | |
| | | //售后计算 |
| | |
| | | |
| | | private void setPartnerIncome(OrderItem oi, OrderItemSettlement ois){ |
| | | //合伙人结算:合伙人加价-理赔-缺货扣款 = 结算金额 |
| | | BigDecimal markupPartner = oi.getMarkupPartner() == null ? new BigDecimal(0) : oi.getMarkupPartner(); |
| | | BigDecimal markupPartner = getAmount(oi.getMarkupPartner()); |
| | | BigDecimal totalAmount = markupPartner.multiply(new BigDecimal(oi.getNum())); |
| | | BigDecimal settlementAmount = totalAmount.subtract(ois.getSalesFeePartner()).subtract(ois.getLackFeePartner());//结算金额 |
| | | if(settlementAmount.doubleValue() < 0){ |
| | |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.PriceDTO; |
| | | import com.mzl.flower.dto.request.menber.MemberGrowthRecordDTO; |
| | | import com.mzl.flower.dto.request.payment.*; |
| | | import com.mzl.flower.dto.response.flower.FlowerCartListDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerCartListWrapDTO; |
| | | import com.mzl.flower.dto.response.flower.FlowerDTO; |
| | | import com.mzl.flower.dto.response.flower.ParamItemDTO; |
| | | import com.mzl.flower.dto.response.partner.PartnerOrderDTO; |
| | | import com.mzl.flower.dto.response.payment.*; |
| | | import com.mzl.flower.dto.response.system.CodeValueDTO; |
| | | import com.mzl.flower.dto.response.transport.TransportOrderDTO; |
| | | import com.mzl.flower.dto.response.warehouse.WarehouseLocationDTO; |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import com.mzl.flower.entity.customer.Address; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.flower.Flower; |
| | | import com.mzl.flower.entity.flower.FlowerSupplierSaleNum; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.entity.partner.Partner; |
| | | import com.mzl.flower.entity.payment.*; |
| | | import com.mzl.flower.entity.supplier.Station; |
| | |
| | | import com.mzl.flower.mapper.system.UserWechatMapper; |
| | | import com.mzl.flower.mapper.warehouse.WarehouseLocationMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.flower.FlowerService; |
| | | import com.mzl.flower.service.menber.MemberGrowthRecordService; |
| | | import com.mzl.flower.service.point.CustomerPointService; |
| | | import com.mzl.flower.service.point.PointGoodsService; |
| | | import com.mzl.flower.service.system.CodeService; |
| | | import com.mzl.flower.service.system.WeChatService; |
| | | import com.mzl.flower.service.transport.TransportService; |
| | |
| | | import me.chanjar.weixin.common.error.WxErrorException; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | private OrderItemCheckMapper orderItemCheckMapper; |
| | | |
| | | @Autowired |
| | | private OrderPointGoodsMapper pointGoodsMapper; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private MemberGrowthRecordService memberGrowthRecordService; |
| | | |
| | | @Autowired |
| | | private CustomerPointService customerPointService; |
| | | |
| | | @Autowired |
| | | private PointGoodsService pointGoodsService; |
| | | |
| | | @Autowired |
| | | private RedisLockService lockService; |
| | | |
| | | @Autowired |
| | | private CouponRecordService couponRecordService; |
| | | |
| | | |
| | | public void changeFlower2Cart(CartSaveDTO dto) { |
| | | String userId = SecurityUtils.getUserId(); |
| | |
| | | c.setNum(dto.getNum()); |
| | | c.create(userId); |
| | | |
| | | // 限购 1.首先查看购物车中的数量是否已经超过限售数量 |
| | | final FlowerDTO flowerDetail = flowerService.getFlowerDetail(c.getFlowerId()); |
| | | if(null!=c.getNum() && null!=flowerDetail.getLimited() |
| | | && c.getNum().compareTo(flowerDetail.getLimited())>0){ |
| | | throw new ValidationException("数量不能超过限售数量!"); |
| | | } |
| | | |
| | | // 限购 2.查看已结单的订单的当前花朵已经购买的数量,加当前购物车的加入的数量是否超过限购的数量,查看当前5点前到昨天五点前 |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,c.getFlowerId()); |
| | | Integer tmp=completeNumToday+c.getNum(); |
| | | if(null!=tmp && null!=flowerDetail.getLimited() |
| | | && tmp.compareTo(flowerDetail.getLimited())>0){ |
| | | throw new ValidationException("当天的订单的花数量加上购物车的数量不能超过限售数量!"); |
| | | } |
| | | |
| | | cartMapper.insert(c); |
| | | } else { |
| | | c.setNum(c.getNum() + dto.getNum()); |
| | | // 查看是否已经超过当前商品的限购数量 |
| | | final FlowerDTO flowerDetail = flowerService.getFlowerDetail(c.getFlowerId()); |
| | | c.setNum((c.getNum()==null?0:c.getNum()) + dto.getNum()); |
| | | |
| | | // 限购 1.首先查看购物车中的数量是否已经超过限售数量 |
| | | if(null!=c.getNum() && null!=flowerDetail.getLimited() |
| | | && c.getNum().compareTo(flowerDetail.getLimited())>0){ |
| | | throw new ValidationException("数量不能超过限售数量!"); |
| | | } |
| | | |
| | | // 限购 2.查看已结单的订单的当前花朵已经购买的数量,加当前购物车的加入的数量是否超过限购的数量,查看当前5点前到昨天五点前 |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,c.getFlowerId()); |
| | | Integer tmp=completeNumToday+c.getNum(); |
| | | if(null!=tmp && null!=flowerDetail.getLimited() |
| | | && tmp.compareTo(flowerDetail.getLimited())>0){ |
| | | throw new ValidationException("当天的订单的花数量加上购物车的数量不能超过限售数量!"); |
| | | } |
| | | |
| | | c.update(userId); |
| | | if (c.getNum() <= 0) { |
| | | cartMapper.deleteById(c.getId()); |
| | |
| | | if (ls != null && ls.size() > 0) { |
| | | Customer customer = getCurrentCustomer(); |
| | | Long partnerId = customer.getPartnerId(); |
| | | Long levelId = customer.getLevelId(); |
| | | Member member = getMember(levelId); |
| | | |
| | | Map<Long, FlowerCartListWrapDTO> map = new HashMap<>(); |
| | | for (FlowerCartListDTO c : ls) { |
| | | BigDecimal price = getFinalPrice(partnerId, c.getCategory() |
| | | , c.getId(), c.getPrice(), c.getLevel()); |
| | | c.setPrice(price); |
| | | c.setPriceMember(calculateMemberPrice(price, member)); |
| | | |
| | | c.setTotal(price.multiply(new BigDecimal(c.getNum()))); |
| | | c.setTotalMember(c.getPriceMember().multiply(new BigDecimal(c.getNum()))); |
| | | |
| | | if (c.getSales() != null && c.getRealSales() != null) { |
| | | c.setSales(c.getSales() + c.getRealSales()); |
| | |
| | | } |
| | | |
| | | public PreOrderDTO getPreOrderInfo(List<CartSaveDTO> flowers, Map<Long, PriceDTO> priceMap) { |
| | | String userId = SecurityUtils.getUserId(); |
| | | |
| | | if (flowers == null || flowers.size() == 0) { |
| | | throw new ValidationException("请选择商品"); |
| | | } |
| | |
| | | } |
| | | idNumMap.put(id, num); |
| | | } |
| | | |
| | | // 限购数量校验 鲜花数量校验 |
| | | flowers.forEach(cartSaveDTO -> { |
| | | // 限购数量 鲜花数量校验 |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,cartSaveDTO.getId()); |
| | | Integer tmp=completeNumToday+cartSaveDTO.getNum(); |
| | | Flower flower=flowerMapper.selectById(cartSaveDTO.getId()); |
| | | if(null!=flower.getLimited() && tmp.compareTo(flower.getLimited())>0){ |
| | | throw new ValidationException("商品:'"+flower.getName()+"' 昨天17:00到今天17:00 超过限售数量:"+flower.getLimited()+"!"); |
| | | } |
| | | }); |
| | | |
| | | PreOrderDTO result = new PreOrderDTO(); |
| | | |
| | | List<FlowerCartListDTO> ls = flowerMapper.selectFlowerOrderList(ids); |
| | | Customer customer = getCurrentCustomer(); |
| | | Long partnerId = customer.getPartnerId(); |
| | | Long levelId = customer.getLevelId(); |
| | | Member member = getMember(levelId); |
| | | if (member != null) { |
| | | result.setMemberId(levelId); |
| | | result.setMemberName(member.getName()); |
| | | result.setMemberDiscountType(member.getDiscountType()); |
| | | result.setMemberDiscountRatio(member.getDiscountRatio()); |
| | | result.setMemberDiscountAmount(member.getDiscountAmount()); |
| | | } |
| | | |
| | | double totalWeight = 0D; |
| | | int num = 0; |
| | | BigDecimal totalAmount = new BigDecimal(0); |
| | | BigDecimal totalMemberAmount = new BigDecimal(0); |
| | | for (FlowerCartListDTO c : ls) { |
| | | if (!Constants.FLOWER_STATUS.UP.name().equals(c.getStatus())) { |
| | | throw new ValidationException("商品" + c.getName() + "已下架,请重新提交"); |
| | |
| | | , c.getId(), c.getPrice(), c.getLevel()); |
| | | BigDecimal price = priceDTO.getPrice(); |
| | | c.setPrice(price); |
| | | c.setPriceMember(calculateMemberPrice(price, member)); |
| | | |
| | | c.setTotal(price.multiply(new BigDecimal(c.getNum()))); |
| | | c.setTotalMember(c.getPriceMember().multiply(new BigDecimal(c.getNum())));//使用会员价计算总价 |
| | | |
| | | if (priceMap != null) { |
| | | priceMap.put(c.getId(), priceDTO); |
| | |
| | | |
| | | totalWeight += c.getWeight() * c.getNum(); |
| | | totalAmount = totalAmount.add(c.getTotal()); |
| | | totalMemberAmount = totalMemberAmount.add(c.getTotalMember()); |
| | | num += c.getNum(); |
| | | } |
| | | |
| | |
| | | result.setFlowers(ls); |
| | | result.setPacking(packing); |
| | | result.setTotalAmount(totalAmount); |
| | | result.setTotalMemberAmount(totalMemberAmount); |
| | | result.setTotalWeight(totalWeight); |
| | | |
| | | return result; |
| | |
| | | } |
| | | |
| | | public Map commitOrder(OrderCommitDTO dto, PreOrderDTO p, Map<Long, PriceDTO> priceMap) { |
| | | String userId = SecurityUtils.getUserId(); |
| | | p.getFlowers().forEach(flower -> { |
| | | // 限购数量 鲜花数量校验 |
| | | Integer completeNumToday=getFlowerCompleteNumToday(userId,flower.getId()); |
| | | Integer tmp=completeNumToday+flower.getNum(); |
| | | if(null!=tmp && null!=flower.getLimited() |
| | | && tmp.compareTo(flower.getLimited())>0){ |
| | | throw new ValidationException("商品:'"+flower.getName()+"' 昨天17:00到今天17:00 超过限售数量:"+flower.getLimited()+"!"); |
| | | } |
| | | }); |
| | | |
| | | WxMaJscode2SessionResult session = null; |
| | | try { |
| | | session = weChatService.getWxMaSessionInfo(dto.getWxcode()); |
| | |
| | | } |
| | | |
| | | Address address = addressMapper.selectById(dto.getAddressId()); |
| | | List<TransportOrderDTO> tLs = transportService.getPreOrderTransportList(address, p.getTotalWeight(), dto.getTransportId()); |
| | | List<TransportOrderDTO> tLs = transportService.getPreOrderTransportList(address |
| | | , p.getTotalWeight(), dto.getTransportId()); |
| | | BigDecimal transportFee = new BigDecimal(0); |
| | | String deliveryName = ""; |
| | | if (tLs != null && tLs.size() > 0) { |
| | |
| | | deliveryName = d.getName(); |
| | | } |
| | | |
| | | String userId = SecurityUtils.getUserId(); |
| | | |
| | | Order order = new Order(); |
| | | order.setId(UUIDGenerator.getUUID()); |
| | | |
| | | final List<Long> goodsRecordIdList = dto.getGoodsRecordIdList(); |
| | | usePointGoods(order.getId(), goodsRecordIdList);//使用积分商品兑换券 |
| | | |
| | | order.create(userId); |
| | | order.setRemarks(dto.getRemarks()); |
| | | order.setSpecialNeeds(dto.getSpecialNeeds()); |
| | | order.setStatusBackend(Constants.ORDER_STATUS_BACKEND.PENDING.name()); |
| | | order.setStatus(Constants.ORDER_STATUS.PENDING.name()); |
| | | |
| | | order.setFlowerAmount(p.getTotalAmount()); |
| | | //设置下单时的会员信息 |
| | | order.setMemberId(p.getMemberId()); |
| | | order.setMemberName(p.getMemberName()); |
| | | order.setMemberDiscountType(p.getMemberDiscountType()); |
| | | order.setMemberDiscountRatio(p.getMemberDiscountRatio()); |
| | | order.setMemberCouponAmount(p.getMemberDiscountAmount()); |
| | | |
| | | order.setFlowerAmount(p.getTotalMemberAmount());//使用会员价总价 |
| | | order.setPackingFee(p.getPacking()); |
| | | order.setTransportFee(transportFee); |
| | | order.setDeliveryName(deliveryName); |
| | | |
| | | BigDecimal totalAmount = order.getFlowerAmount().add(p.getPacking()).add(transportFee); |
| | | BigDecimal totalAmount = order.getFlowerAmount();//使用优惠券之前的总价,使用商品价格 |
| | | CouponRecordDO coupon = useCouponRecord(order.getId(), totalAmount, dto.getCouponRecordId()); |
| | | log.info("用户优惠券: " + coupon); |
| | | if(coupon != null){ |
| | | order.setMemberCouponId(coupon.getId()); |
| | | order.setMemberCouponCode(coupon.getCouponCode()); |
| | | order.setMemberCouponName(coupon.getCouponName()); |
| | | order.setMemberCouponAmount(coupon.getCouponDiscountValue()); |
| | | |
| | | totalAmount = totalAmount.subtract(order.getMemberCouponAmount());//满足条件需要减去优惠券金额 |
| | | } |
| | | if(totalAmount.doubleValue() < 0){//假如扣除优惠券后金额小于0,则按0计算 |
| | | totalAmount = new BigDecimal(0); |
| | | } |
| | | totalAmount = totalAmount.add(p.getPacking()).add(transportFee); |
| | | if(totalAmount.doubleValue() <= 0){//假如总价小于等于0,则支付0.01元 |
| | | totalAmount = new BigDecimal(0.01); |
| | | } |
| | | order.setTotalAmount(totalAmount); |
| | | |
| | | order.setCustomer(address.getName()); |
| | |
| | | //商品列表处理 |
| | | List<FlowerCartListDTO> flowers = p.getFlowers(); |
| | | Map<Long, List<ParamItemDTO>> paramMap = new HashMap<>(); |
| | | for (FlowerCartListDTO f : flowers) { |
| | | final BigDecimal flowerAmount = order.getFlowerAmount();//订单商品总价 |
| | | final BigDecimal memberCouponAmount = order.getMemberCouponAmount();//使用优惠券面值 |
| | | BigDecimal usedCouponAmount = new BigDecimal(0); |
| | | for (int i = 0; i < flowers.size(); i++) { |
| | | FlowerCartListDTO f = flowers.get(i); |
| | | |
| | | OrderItem t = new OrderItem(); |
| | | t.setId(UUIDGenerator.getUUID()); |
| | | t.setOrderId(order.getId()); |
| | |
| | | t.setMarkupOne(pp.getFirstFee()); |
| | | t.setMarkupTwo(pp.getSecondFee()); |
| | | t.setMarkupPartner(pp.getPartnerFee()); |
| | | t.setPrice(pp.getPrice()); |
| | | t.setTotal(f.getTotal()); |
| | | t.setPrice(f.getPriceMember());//使用会员单价 |
| | | t.setTotal(f.getTotalMember());//使用会员总价 |
| | | |
| | | t.setOriginalPrice(pp.getPrice());//非会员售价 |
| | | boolean isLastOne = i == (flowers.size() - 1); |
| | | BigDecimal couponAmount = calculateCoupon(memberCouponAmount, t.getTotal() |
| | | , flowerAmount, t.getNum(), t.getPrice(), isLastOne, usedCouponAmount); |
| | | t.setCouponAmount(couponAmount);//每扎平摊的优惠券面值 |
| | | t.setRealPrice(t.getPrice().subtract(couponAmount));//退款时使用的真实成交单价 |
| | | |
| | | t.setCouponAmountTotal(couponAmount.multiply(BigDecimal.valueOf(t.getNum()))); |
| | | if(isLastOne){ |
| | | t.setCouponAmountTotal(memberCouponAmount.subtract(usedCouponAmount)); |
| | | } else { |
| | | usedCouponAmount = usedCouponAmount.add(t.getCouponAmountTotal()); |
| | | } |
| | | t.setRealTotal(t.getTotal().subtract(t.getCouponAmountTotal())); |
| | | |
| | | t.create(userId); |
| | | orderItemMapper.insert(t); |
| | |
| | | order.setPayOpenid(openId); |
| | | orderMapper.insert(order); |
| | | |
| | | //处理积分商品兑换券 |
| | | if(goodsRecordIdList != null && goodsRecordIdList.size() > 0){ |
| | | for(Long goodsRecordId : goodsRecordIdList){ |
| | | OrderPointGoods g = new OrderPointGoods(); |
| | | g.setId(UUIDGenerator.getUUID()); |
| | | g.setOrderId(order.getId()); |
| | | g.setGoodsRecordId(goodsRecordId); |
| | | g.create(userId); |
| | | pointGoodsMapper.insert(g); |
| | | } |
| | | } |
| | | |
| | | Map map = paymentV3Service.wxPrepay(order); |
| | | map.put("_testV2OrderId", order.getId()); |
| | | return map; |
| | | } |
| | | |
| | | private void usePointGoods(String orderId, List<Long> goodsRecordIdList){ |
| | | //使用积分商品兑换券 |
| | | if(goodsRecordIdList != null && goodsRecordIdList.size() > 0){ |
| | | for(Long grId : goodsRecordIdList){ |
| | | pointGoodsService.useExchangeGoods(grId, orderId); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 计算订单中每种商品每扎平摊的优惠券面值,保留2位小数 |
| | | * |
| | | * @param couponAmount |
| | | * @param itemTotalAmount |
| | | * @param totalAmount |
| | | * @param num |
| | | * @param price |
| | | * @return |
| | | */ |
| | | private BigDecimal calculateCoupon(BigDecimal couponAmount, BigDecimal itemTotalAmount |
| | | , BigDecimal totalAmount, Integer num, BigDecimal price |
| | | , boolean isLastOne, BigDecimal usedCouponAmount){ |
| | | if(couponAmount == null){ |
| | | return new BigDecimal(0); |
| | | } |
| | | |
| | | if(couponAmount.doubleValue() >= totalAmount.doubleValue()){ |
| | | return price; |
| | | } |
| | | if(isLastOne){//最后的商品使用优惠券剩下的面值 |
| | | BigDecimal subCoupon = couponAmount.subtract(usedCouponAmount);//占有的优惠券面值 |
| | | return subCoupon.divide(BigDecimal.valueOf(num), 2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | /*BigDecimal radio = itemTotalAmount.divide(totalAmount, 2, RoundingMode.HALF_UP);//计算该商品总价在订单中的占比 |
| | | BigDecimal subCoupon = couponAmount.multiply(radio);//占有的优惠券面值 |
| | | return subCoupon.divide(BigDecimal.valueOf(num), 2, RoundingMode.HALF_UP);*/ |
| | | |
| | | //不能分步计算,分步计算会有精度问题 |
| | | return couponAmount.multiply(itemTotalAmount).divide(totalAmount.multiply(BigDecimal.valueOf(num)), 2, RoundingMode.HALF_UP); |
| | | } |
| | | |
| | | private CouponRecordDO useCouponRecord(String orderId, BigDecimal amount, String couponRecordId){ |
| | | log.info("使用用户优惠券id: " + couponRecordId + "; 订单id: " + orderId); |
| | | if(StringUtils.isNotEmpty(couponRecordId)){ |
| | | //优惠券使用和验证,如果不符合使用条件需要抛出异常。需调用优惠券使用方法 |
| | | couponRecordService.useCoupon(couponRecordId, orderId, amount); |
| | | return couponRecordService.getCouponRecordById(couponRecordId); |
| | | } |
| | | |
| | | return null; |
| | | } |
| | | |
| | | private String getOrderNo() { |
| | |
| | | orderIds.add(o.getId()); |
| | | } |
| | | |
| | | List<OrderItem> itemList = orderItemMapper.selectList( |
| | | new QueryWrapper<OrderItem>().in("order_id", orderIds)); |
| | | List<OrderItemListDTO> itemList = orderItemMapper.getOrderItems(orderIds); |
| | | Map<String, List<OrderItemListDTO>> map = new HashMap<>(); |
| | | for (OrderItem oi : itemList) { |
| | | for (OrderItemListDTO oi : itemList) { |
| | | String orderId = oi.getOrderId(); |
| | | List<OrderItemListDTO> ll = map.computeIfAbsent(orderId, k -> new ArrayList<>()); |
| | | OrderItemListDTO d = new OrderItemListDTO(); |
| | |
| | | if(llc == null){ |
| | | llc = new OrderCheckLocationListDTO(); |
| | | BeanUtils.copyProperties(c, llc); |
| | | rMap.put(locationId, llc); |
| | | llc.setTotalAmount(new BigDecimal(0)); |
| | | |
| | | rMap.put(locationId, llc); |
| | | result.add(llc); |
| | | } |
| | | |
| | | BigDecimal t = llc.getTotalAmount(); |
| | | if(t == null){ |
| | | t = new BigDecimal(0); |
| | | } |
| | | t = t.add(c.getTotalAmount()); |
| | | llc.setTotalAmount(t); |
| | | } |
| | | |
| | | Map<Long, String> stationMap = prepareStationMap(); |
| | |
| | | boolean couldCheckRefund = StringUtils.isEmpty(transferId) && count == 0 && cc == 0; |
| | | dto.setCouldCheckRefund(couldCheckRefund); |
| | | |
| | | List<OrderPointGoodsListDTO> pointGoodsList = orderMapper.getPointGoodsList(id); |
| | | dto.setPointGoodsList(pointGoodsList); |
| | | |
| | | return dto; |
| | | } |
| | | |
| | |
| | | return result; |
| | | } |
| | | |
| | | public void autoReceive() { |
| | | public List<Order> autoReceive() { |
| | | int days = -5; //5天前的订单自动收货 |
| | | LocalDateTime endTime = LocalDateTime.now().plusDays(days); |
| | | List<Order> ls = orderMapper.getOrderForAutoReceive(endTime); |
| | | if (ls == null || ls.size() == 0) { |
| | | return; |
| | | return ls; |
| | | } |
| | | |
| | | for (Order o : ls) { |
| | |
| | | o.setReceiveTime(LocalDateTime.now()); |
| | | o.update("sys"); |
| | | orderMapper.updateById(o); |
| | | |
| | | } |
| | | |
| | | return ls; |
| | | } |
| | | |
| | | public void processAfterReceive(Order o){ |
| | | String status = o.getStatus(); |
| | | if(!Constants.ORDER_STATUS.EVALUATE.name().equals(status)){ |
| | | log.warn("订单未确认收货,无法处理积分和成长值"); |
| | | return; |
| | | } |
| | | |
| | | BigDecimal totalAmount = o.getTotalAmount(); |
| | | List<OrderItemCheck> checkList = orderItemCheckMapper.selectList(new QueryWrapper<OrderItemCheck>() |
| | | .eq("order_id", o.getId()) |
| | | .eq("audit_status", Constants.CHECK_AUDIT_STATUS.AGREED.name()) |
| | | ); |
| | | |
| | | if(checkList != null && checkList.size() > 0){ |
| | | for(OrderItemCheck c : checkList){ |
| | | if(Constants.CHECK_TYPE.replace.name().equals(c.getType())){ |
| | | continue; |
| | | } |
| | | totalAmount = totalAmount.subtract(getAmount(c.getDeductAmount())); |
| | | } |
| | | } |
| | | |
| | | //成长值计算 |
| | | MemberGrowthRecordDTO mDto = new MemberGrowthRecordDTO(); |
| | | mDto.setTotalAmount(totalAmount); |
| | | mDto.setUserId(o.getCreateBy()); |
| | | mDto.setSource(Constants.GROWTH_SOURCE.consume.name()); |
| | | mDto.setType(Constants.GROWTH_TYPE.add.name()); |
| | | mDto.setRemarks("订单: " + o.getOrderNo()); |
| | | memberGrowthRecordService.saveMemberGrowthRecord(mDto); |
| | | |
| | | //积分计算 |
| | | customerPointService.consumptionPoint(totalAmount, o.getOrderNo(), o.getCreateBy()); |
| | | } |
| | | |
| | | public JSONObject sendWxDeliveryGood(Order o) { |
| | |
| | | } |
| | | } |
| | | |
| | | public void confirmOrderReceive(String id) { |
| | | public Order confirmOrderReceive(String id) { |
| | | Order o = orderMapper.selectById(id); |
| | | String userId = SecurityUtils.getUserId(); |
| | | if (!userId.equals(o.getCreateBy())) { |
| | |
| | | o.setReceiveTime(LocalDateTime.now()); |
| | | o.update(userId); |
| | | orderMapper.updateById(o); |
| | | |
| | | return o; |
| | | } |
| | | |
| | | public Integer getMyOrderStatusCount(String status) { |
| | |
| | | order.update(SecurityUtils.getUserId()); |
| | | orderMapper.updateById(order); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户最后收货时间 |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | public LocalDateTime getUserLastOrderTime(String userId){ |
| | | Order o = orderMapper.getUserLastOrder(userId); |
| | | return o.getReceiveTime(); |
| | | } |
| | | |
| | | public Integer getFlowerCompleteNumToday(String userId,Long flowerId){ |
| | | Integer completeNum= orderMapper.getFlowerCompleteNumToday(userId,flowerId); |
| | | return completeNum; |
| | | } |
| | | } |
| | |
| | | } |
| | | String type = settlement.getType(); |
| | | |
| | | String name = ""; |
| | | if(Constants.SETTLEMENT_TYPE.supplier.name().equals(type)){ |
| | | Supplier s = supplierMapper.selectOne(new QueryWrapper<Supplier>() |
| | | .eq("user_id", settlement.getUserId())); |
| | | name = "供应商" + s.getName(); |
| | | } else { |
| | | Partner p = partnerMapper.selectOne(new QueryWrapper<Partner>() |
| | | .eq("user_id", settlement.getUserId())); |
| | | name = "合伙人" + p.getName(); |
| | | } |
| | | |
| | | UserWechat wechat = wechatMapper.selectOne(new QueryWrapper<UserWechat>() |
| | | .eq("user_id", settlement.getUserId())); |
| | | if(wechat == null){ |
| | | String msg; |
| | | if(Constants.SETTLEMENT_TYPE.supplier.name().equals(type)){ |
| | | Supplier s = supplierMapper.selectOne(new QueryWrapper<Supplier>() |
| | | .eq("user_id", settlement.getUserId())); |
| | | msg = "供应商" + s.getName() + "未绑定账号无法结算"; |
| | | } else { |
| | | Partner p = partnerMapper.selectOne(new QueryWrapper<Partner>() |
| | | .eq("user_id", settlement.getUserId())); |
| | | msg = "合伙人" + p.getName() + "未绑定账号无法结算"; |
| | | } |
| | | String msg = name + "未绑定账号无法结算"; |
| | | log.error(msg); |
| | | throw new ValidationException(msg); |
| | | } |
| | |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | String day = format(now, "yyyy-MM-dd"); |
| | | |
| | | String remarks = Constants.SETTLEMENT_TYPE.supplier.name().equals(type) |
| | | ? "供应商账单结算" : "合伙人账单结算"; |
| | | String remarks = name + "账单结算"; |
| | | |
| | | String appId = Constants.SETTLEMENT_TYPE.supplier.name().equals(type) |
| | | ? PyamentV3Configurer.supplier_app_id : PyamentV3Configurer.partner_app_id; |
| | |
| | | import com.mzl.flower.mapper.payment.*; |
| | | import com.mzl.flower.mapper.system.UserWechatMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.flower.FlowerService; |
| | | import com.mzl.flower.service.point.PointGoodsService; |
| | | import com.mzl.flower.utils.UUIDGenerator; |
| | | import com.wechat.pay.java.core.notification.NotificationParser; |
| | | import com.wechat.pay.java.core.notification.RequestParam; |
| | |
| | | |
| | | @Autowired |
| | | private OrderRefundMapper orderRefundMapper; |
| | | |
| | | @Autowired |
| | | private OrderPointGoodsMapper orderPointGoodsMapper; |
| | | |
| | | @Autowired |
| | | private PointGoodsService pointGoodsService; |
| | | |
| | | @Autowired |
| | | private CouponRecordService couponRecordService; |
| | | |
| | | /** |
| | | * 微信预支付 |
| | |
| | | } |
| | | |
| | | private void releasePrepayLock(Order order){ |
| | | log.info("恢复库存: " + order); |
| | | log.info("恢复库存 积分商品兑换券 优惠券: " + order); |
| | | revertFlowerStock(order.getId()); |
| | | |
| | | //恢复积分商品兑换券 |
| | | revertPointGoodsRecord(order.getId()); |
| | | |
| | | //恢复优惠券 |
| | | String memberCouponId = order.getMemberCouponId(); |
| | | if(StringUtils.isNotEmpty(memberCouponId)) { |
| | | couponRecordService.cancelCouponUsage(order.getId()); |
| | | } |
| | | } |
| | | |
| | | private void revertPointGoodsRecord(String orderId){ |
| | | List<OrderPointGoods> ls = orderPointGoodsMapper.selectList(new QueryWrapper<OrderPointGoods>() |
| | | .eq("order_id", orderId)); |
| | | if(ls != null && ls.size() > 0){ |
| | | for(OrderPointGoods pg : ls){ |
| | | pointGoodsService.revertExchangeGoods(pg.getGoodsRecordId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public Map payAgain(String orderId){ |
| | |
| | | orderKey.put("mchid",merchantId);//支付下单商户的商户号,由微信支付生成并下发。 |
| | | orderKey.put("out_trade_no",orderId);//商户系统内部订单号 |
| | | body.put("order_key",orderKey); |
| | | body.put("logistics_type",4);//物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提 |
| | | body.put("logistics_type",2);//物流模式,发货方式枚举值:1、实体物流配送采用快递公司进行实体物流配送形式 2、同城配送 3、虚拟商品,虚拟商品,例如话费充值,点卡等,无实体配送形式 4、用户自提 |
| | | body.put("delivery_mode",1);//发货模式,发货模式枚举值:1、UNIFIED_DELIVERY(统一发货)2、SPLIT_DELIVERY(分拆发货) 示例值: UNIFIED_DELIVERY |
| | | |
| | | //商品信息 |
对比新文件 |
| | |
| | | package com.mzl.flower.service.point; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.dto.request.point.ChangePointDTO; |
| | | import com.mzl.flower.dto.request.point.QueryCustomerPointDTO; |
| | | import com.mzl.flower.dto.request.point.QueryPointDetailDTO; |
| | | import com.mzl.flower.dto.response.point.CustomerPointDTO; |
| | | import com.mzl.flower.dto.response.point.CustomerPointDetailDTO; |
| | | import com.mzl.flower.entity.customer.Customer; |
| | | import com.mzl.flower.entity.point.CustomerPoint; |
| | | import com.mzl.flower.entity.point.CustomerPointDetail; |
| | | import com.mzl.flower.mapper.point.CustomerPointDetailMapper; |
| | | import com.mzl.flower.mapper.point.CustomerPointMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDate; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import com.mzl.flower.constant.Constants.*; |
| | | |
| | | @Service |
| | | @Transactional |
| | | public class CustomerPointService extends BaseService { |
| | | |
| | | private final CustomerPointMapper customerPointMapper; |
| | | |
| | | private final CustomerPointDetailMapper customerPointDetailMapper; |
| | | |
| | | |
| | | public CustomerPointService(CustomerPointMapper customerPointMapper, CustomerPointDetailMapper customerPointDetailMapper) { |
| | | this.customerPointMapper = customerPointMapper; |
| | | this.customerPointDetailMapper = customerPointDetailMapper; |
| | | } |
| | | |
| | | public Page<CustomerPointDTO> queryPage(QueryCustomerPointDTO dto, Page page) { |
| | | List<CustomerPointDTO> list = customerPointMapper.queryPage(dto, page); |
| | | page.setRecords(list); |
| | | return page; |
| | | } |
| | | |
| | | public Page<CustomerPointDetailDTO> queryCustomerDetails(QueryPointDetailDTO dto, Page page) { |
| | | List<CustomerPointDetailDTO> list = customerPointMapper.queryCustomerDetails(dto, page); |
| | | page.setRecords(list); |
| | | |
| | | return page; |
| | | } |
| | | |
| | | public void giveawayPoint(ChangePointDTO dto) { |
| | | CustomerPointDetail detail = new CustomerPointDetail(); |
| | | Customer customer = getCustomer(dto.getCustomerId()); |
| | | detail.setCustomerId(customer.getId()); |
| | | detail.setUserId(customer.getUserId()); |
| | | detail.setPoint(dto.getPoint()); |
| | | detail.setRemarks(dto.getRemarks()); |
| | | detail.setRecordDate(LocalDate.now()); |
| | | detail.setChangeType(POINT_CHANGE_TYPE.add.name()); |
| | | detail.setType(POINT_TYPE.giveaway.name()); |
| | | detail.create(SecurityUtils.getUserId()); |
| | | customerPointDetailMapper.insert(detail); |
| | | |
| | | //更新汇总表 |
| | | updateCustomerPoint(detail); |
| | | } |
| | | |
| | | public void updateCustomerPoint(CustomerPointDetail detail) { |
| | | CustomerPoint point = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>() |
| | | .eq(CustomerPoint::getCustomerId, detail.getCustomerId())); |
| | | boolean isAdd = false; |
| | | if(point == null){ |
| | | isAdd = true; |
| | | point = new CustomerPoint(); |
| | | point.setCustomerId(detail.getCustomerId()); |
| | | point.setUserId(detail.getUserId()); |
| | | point.setTotalPoint(0); |
| | | point.setUsedPoint(0); |
| | | point.setExpiredPoint(0); |
| | | point.setDeductionPoint(0); |
| | | point.create(SecurityUtils.getUserId()); |
| | | } |
| | | |
| | | if(POINT_CHANGE_TYPE.add.name().equals(detail.getChangeType())){ |
| | | point.setTotalPoint(point.getTotalPoint() + detail.getPoint()); |
| | | }else if(POINT_CHANGE_TYPE.reduce.name().equals(detail.getChangeType())){ |
| | | Integer detailPoint = detail.getPoint(); |
| | | if(POINT_TYPE.deduction.name().equals(detail.getType())){ //积分扣减 |
| | | Integer balancePoint = point.getTotalPoint() - point.getUsedPoint()-point.getExpiredPoint()-point.getDeductionPoint();//可用积分 |
| | | balancePoint = balancePoint.intValue()>0?balancePoint.intValue():0; |
| | | if(balancePoint.intValue() >= detail.getPoint().intValue()){ |
| | | point.setDeductionPoint(point.getDeductionPoint() + detail.getPoint()); |
| | | }else{ |
| | | //积分不足,直接清0 |
| | | point.setDeductionPoint(point.getDeductionPoint() + balancePoint); |
| | | detail.setPoint(balancePoint); |
| | | detail.setRemarks(detail.getRemarks()+",当前积分不足"+detailPoint+",实际扣除积分"+balancePoint); |
| | | } |
| | | } |
| | | } |
| | | if(isAdd){ |
| | | customerPointMapper.insert(point); |
| | | }else{ |
| | | customerPointMapper.updateById(point); |
| | | } |
| | | |
| | | } |
| | | |
| | | public void deductionPoint(ChangePointDTO dto) { |
| | | CustomerPointDetail detail = new CustomerPointDetail(); |
| | | Customer customer = getCustomer(dto.getCustomerId()); |
| | | detail.setCustomerId(customer.getId()); |
| | | detail.setUserId(customer.getUserId()); |
| | | detail.setPoint(dto.getPoint()); |
| | | detail.setRemarks(dto.getRemarks()); |
| | | detail.setRecordDate(LocalDate.now()); |
| | | detail.setChangeType(POINT_CHANGE_TYPE.reduce.name()); |
| | | detail.setType(POINT_TYPE.deduction.name()); |
| | | detail.create(SecurityUtils.getUserId()); |
| | | //更新汇总表 |
| | | updateCustomerPoint(detail); |
| | | |
| | | customerPointDetailMapper.insert(detail); |
| | | } |
| | | |
| | | public void consumptionPoint(BigDecimal orderAmount, String orderNo,String userId) { |
| | | CustomerPointDetail detail = new CustomerPointDetail(); |
| | | Customer customer = getCustomerByUserId(userId); |
| | | detail.setCustomerId(customer.getId()); |
| | | detail.setUserId(customer.getUserId()); |
| | | BigDecimal point = orderAmount.setScale(0, BigDecimal.ROUND_HALF_UP); |
| | | detail.setPoint(point.intValue()); |
| | | detail.setRemarks(orderNo); |
| | | detail.setRecordDate(LocalDate.now()); |
| | | detail.setChangeType(POINT_CHANGE_TYPE.add.name()); |
| | | detail.setType(POINT_TYPE.consume.name()); |
| | | detail.create(SecurityUtils.getUserId()); |
| | | customerPointDetailMapper.insert(detail); |
| | | |
| | | //更新汇总表 |
| | | updateCustomerPoint(detail); |
| | | } |
| | | |
| | | public void signIn() { |
| | | if(signToday()){ |
| | | throw new ValidationException("今天已经签到过了"); |
| | | } |
| | | int signNum = customerPointDetailMapper |
| | | .selectCount(new LambdaQueryWrapper<CustomerPointDetail>() |
| | | .eq(CustomerPointDetail::getUserId, SecurityUtils.getUserId()) |
| | | .ge(CustomerPointDetail::getRecordDate,LocalDate.now().minusDays(9)) |
| | | .eq(CustomerPointDetail::getChangeType,POINT_CHANGE_TYPE.add.name()) |
| | | .eq(CustomerPointDetail::getType,POINT_TYPE.sign.name()) |
| | | ); |
| | | int point = 1; |
| | | if(signNum==9){ |
| | | point = 3; |
| | | } |
| | | CustomerPointDetail detail = new CustomerPointDetail(); |
| | | Customer customer = getCurrentCustomer(); |
| | | detail.setCustomerId(customer.getId()); |
| | | detail.setUserId(customer.getUserId()); |
| | | detail.setPoint(point); |
| | | detail.setRemarks("签到"); |
| | | detail.setRecordDate(LocalDate.now()); |
| | | detail.setChangeType(POINT_CHANGE_TYPE.add.name()); |
| | | detail.setType(POINT_TYPE.sign.name()); |
| | | detail.create(SecurityUtils.getUserId()); |
| | | customerPointDetailMapper.insert(detail); |
| | | |
| | | //更新汇总表 |
| | | updateCustomerPoint(detail); |
| | | } |
| | | |
| | | public List<CustomerPointDetailDTO> signList(LocalDate startDate, LocalDate endDate) { |
| | | LambdaQueryWrapper<CustomerPointDetail> lambdaQueryWrapper = new LambdaQueryWrapper<CustomerPointDetail>() |
| | | .eq(CustomerPointDetail::getUserId, SecurityUtils.getUserId()) |
| | | .eq(CustomerPointDetail::getChangeType, POINT_CHANGE_TYPE.add.name()) |
| | | .eq(CustomerPointDetail::getType, POINT_TYPE.sign.name()); |
| | | lambdaQueryWrapper.orderByDesc(CustomerPointDetail::getRecordDate); |
| | | if(startDate!=null){ |
| | | lambdaQueryWrapper.ge(CustomerPointDetail::getRecordDate,startDate); |
| | | } |
| | | if (endDate != null) { |
| | | lambdaQueryWrapper.le(CustomerPointDetail::getRecordDate, endDate); |
| | | } |
| | | |
| | | List<CustomerPointDetail> details = customerPointDetailMapper.selectList(lambdaQueryWrapper); |
| | | List<CustomerPointDetailDTO> dtos = new ArrayList<>(); |
| | | for (CustomerPointDetail detail : details) { |
| | | CustomerPointDetailDTO dto = new CustomerPointDetailDTO(); |
| | | BeanUtils.copyProperties(detail, dto); |
| | | dtos.add(dto); |
| | | } |
| | | return dtos; |
| | | } |
| | | |
| | | public Boolean signToday() { |
| | | return customerPointDetailMapper.selectCount(new LambdaQueryWrapper<CustomerPointDetail>() |
| | | .eq(CustomerPointDetail::getUserId, SecurityUtils.getUserId()) |
| | | .eq(CustomerPointDetail::getRecordDate,LocalDate.now()) |
| | | .eq(CustomerPointDetail::getChangeType,POINT_CHANGE_TYPE.add.name()) |
| | | .eq(CustomerPointDetail::getType,POINT_TYPE.sign.name()))>0; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.service.point; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.request.point.*; |
| | | import com.mzl.flower.dto.response.point.PointGoodsDTO; |
| | | import com.mzl.flower.dto.response.point.PointGoodsListDTO; |
| | | import com.mzl.flower.dto.response.point.PointGoodsRecordDTO; |
| | | import com.mzl.flower.entity.point.CustomerPoint; |
| | | import com.mzl.flower.entity.point.CustomerPointDetail; |
| | | import com.mzl.flower.entity.point.PointGoods; |
| | | import com.mzl.flower.entity.point.PointGoodsRecord; |
| | | import com.mzl.flower.mapper.point.CustomerPointDetailMapper; |
| | | import com.mzl.flower.mapper.point.CustomerPointMapper; |
| | | import com.mzl.flower.mapper.point.PointGoodsMapper; |
| | | import com.mzl.flower.mapper.point.PointGoodsRecordMapper; |
| | | import com.mzl.flower.service.BaseService; |
| | | import com.mzl.flower.service.payment.RedisLockService; |
| | | import com.mzl.flower.utils.DateUtils; |
| | | import com.mzl.flower.utils.UUIDGenerator; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | @Transactional |
| | | public class PointGoodsService extends BaseService { |
| | | |
| | | @Autowired |
| | | private PointGoodsMapper pointGoodsMapper; |
| | | |
| | | @Autowired |
| | | private PointGoodsRecordMapper pointGoodsRecordMapper; |
| | | |
| | | @Autowired |
| | | private CustomerPointMapper customerPointMapper; |
| | | |
| | | @Autowired |
| | | private CustomerPointDetailMapper customerPointDetailMapper; |
| | | |
| | | |
| | | @Autowired |
| | | private RedisLockService lockService; |
| | | |
| | | public Long addPointGoods(PointGoodsCreateDTO dto){ |
| | | PointGoods p = new PointGoods(); |
| | | BeanUtils.copyProperties(dto, p); |
| | | p.setPictures(toJSONString(dto.getPictureList())); |
| | | p.setStatus(Constants.POINT_GOODS_STATUS.I.name()); |
| | | |
| | | p.create(SecurityUtils.getUserId()); |
| | | pointGoodsMapper.insert(p); |
| | | |
| | | return p.getId(); |
| | | } |
| | | |
| | | public Long updatePointGoods(PointGoodsUpdateDTO dto){ |
| | | PointGoods p = pointGoodsMapper.selectById(dto.getId()); |
| | | if(p == null){ |
| | | throw new ValidationException("商品未找到"); |
| | | } |
| | | |
| | | BeanUtils.copyProperties(dto, p); |
| | | p.setPictures(toJSONString(dto.getPictureList())); |
| | | |
| | | p.update(SecurityUtils.getUserId()); |
| | | pointGoodsMapper.updateById(p); |
| | | |
| | | return p.getId(); |
| | | } |
| | | |
| | | public void deletePointGoods(String idStr){ |
| | | List<String> ids = splitParam(idStr); |
| | | if (ids != null && ids.size() > 0) { |
| | | for(String idd : ids) { |
| | | Long id = Long.parseLong(idd); |
| | | pointGoodsMapper.deleteById(id); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public Page<PointGoodsListDTO> selectGoodsList(Page page, PointGoodsQueryDTO dto){ |
| | | List<PointGoodsListDTO> ls = pointGoodsMapper.selectGoodsList(page, dto); |
| | | |
| | | page.setRecords(ls); |
| | | return page; |
| | | } |
| | | |
| | | public PointGoodsDTO getGoodsInfo(Long id){ |
| | | PointGoods p = pointGoodsMapper.selectById(id); |
| | | if(p == null){ |
| | | throw new ValidationException("商品未找到"); |
| | | } |
| | | PointGoodsDTO dto = new PointGoodsDTO(); |
| | | BeanUtils.copyProperties(p, dto); |
| | | dto.setPictureList(parseArray(p.getPictures(), String.class)); |
| | | |
| | | return dto; |
| | | } |
| | | |
| | | public void updateStatus(String idStr, String status){ |
| | | List<String> ids = splitParam(idStr); |
| | | if(ids != null && ids.size() > 0) { |
| | | for(String idd : ids) { |
| | | Long id = Long.parseLong(idd); |
| | | PointGoods p = pointGoodsMapper.selectById(id); |
| | | if (p == null) { |
| | | continue; |
| | | } |
| | | |
| | | if(Constants.POINT_GOODS_STATUS.A.name().equals(status)){ |
| | | if(p.getStock() == null || p.getStock() <= 0){ |
| | | throw new ValidationException("商品" + p.getName() + "库存为0不能上架"); |
| | | } |
| | | } |
| | | |
| | | p.setStatus(status); |
| | | p.update(SecurityUtils.getUserId()); |
| | | pointGoodsMapper.updateById(p); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void exchangeGoods(ExchangeGoodsDTO dto) { |
| | | String key="EXCHANGE_GOODS:"+dto.getGoodsId()+":"+SecurityUtils.getUserId(); |
| | | boolean lock = lockService.getObjectLock(key, ""); |
| | | if(!lock){ |
| | | throw new ValidationException("系统操作频繁,请稍后重试"); |
| | | } |
| | | try { |
| | | PointGoods p = pointGoodsMapper.selectById(dto.getGoodsId()); |
| | | if(p == null){ |
| | | throw new ValidationException("商品未找到"); |
| | | } |
| | | if(!Constants.POINT_GOODS_STATUS.A.name().equals(p.getStatus())){ |
| | | throw new ValidationException("商品未上架"); |
| | | } |
| | | if(p.getStock()< dto.getNum()){ |
| | | throw new ValidationException("商品库存不足"); |
| | | } |
| | | CustomerPoint cp = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>() |
| | | .eq(CustomerPoint::getUserId, SecurityUtils.getUserId())); |
| | | if(cp == null || (cp.getTotalPoint()-cp.getUsedPoint()-cp.getExpiredPoint()-cp.getDeductionPoint()) < p.getPoint() * dto.getNum()){ |
| | | throw new ValidationException("积分不足"); |
| | | } |
| | | //记录兑换记录 |
| | | PointGoodsRecord record = new PointGoodsRecord(); |
| | | record.setUserId(SecurityUtils.getUserId()); |
| | | record.setCustomerId(getCustomerByUserId(SecurityUtils.getUserId()).getId()); |
| | | record.setGoodsId(dto.getGoodsId()); |
| | | record.setNum(dto.getNum()); |
| | | record.setPoint(p.getPoint()); |
| | | record.setName(p.getName()); |
| | | record.setPictures(p.getCover()); |
| | | record.setDescription(p.getDescription()); |
| | | record.setTotalPoint(p.getPoint() * dto.getNum()); |
| | | record.setCover(p.getCover()); |
| | | record.setRedeemCode(UUIDGenerator.getUUID()); |
| | | record.setStatus(Constants.POINT_GOODS_RECORD_STATUS.A.name());//未使用 |
| | | LocalDate expireDate = LocalDate.now().plusYears(1); |
| | | String expireDateStr = DateUtils.toString(expireDate,"yyyy-MM-dd"); |
| | | record.setExpireTime(DateUtils.dateToLocalDateTime(expireDateStr,false)); |
| | | record.create(SecurityUtils.getUserId()); |
| | | pointGoodsRecordMapper.insert(record); |
| | | |
| | | //更新积分汇总 |
| | | cp.setUsedPoint(cp.getUsedPoint()+record.getTotalPoint()); |
| | | customerPointMapper.updateById(cp); |
| | | |
| | | //记录积分明细 |
| | | CustomerPointDetail detail = new CustomerPointDetail(); |
| | | detail.setUserId(SecurityUtils.getUserId()); |
| | | detail.setCustomerId(record.getCustomerId()); |
| | | detail.setPoint(record.getTotalPoint()); |
| | | detail.setChangeType(Constants.POINT_CHANGE_TYPE.reduce.name()); |
| | | detail.setType(Constants.POINT_TYPE.exchange.name()); |
| | | detail.setRecordDate(LocalDate.now()); |
| | | detail.setRemarks(record.getName()); |
| | | detail.create(SecurityUtils.getUserId()); |
| | | customerPointDetailMapper.insert(detail); |
| | | |
| | | //更新库存 |
| | | p.setStock(p.getStock()- dto.getNum()); |
| | | pointGoodsMapper.updateById(p); |
| | | }catch (Exception e){ |
| | | throw new ValidationException("兑换失败"); |
| | | }finally { |
| | | lockService.releaseObjectLock(key,""); |
| | | } |
| | | |
| | | } |
| | | |
| | | public Page<PointGoodsRecordDTO> myExchangeGoods(QueryExchangeGoodsDTO dto, Page page) { |
| | | dto.setUserId(SecurityUtils.getUserId()); |
| | | List<PointGoodsRecordDTO> list = pointGoodsRecordMapper.selectMyExchangeGoods(dto,page); |
| | | page.setRecords(list); |
| | | return page; |
| | | } |
| | | |
| | | public void useExchangeGoods(Long recordId,String orderId) { |
| | | PointGoodsRecord record = pointGoodsRecordMapper.selectById(recordId); |
| | | if(record == null){ |
| | | throw new ValidationException("兑换券不存在"); |
| | | } |
| | | if(!Constants.POINT_GOODS_RECORD_STATUS.A.name().equals(record.getStatus())){ |
| | | throw new ValidationException("兑换券已使用或过期"); |
| | | } |
| | | if(!SecurityUtils.getUserId().equals(record.getUserId())){ |
| | | throw new ValidationException("兑换券不属于当前用户"); |
| | | } |
| | | record.setStatus(Constants.POINT_GOODS_RECORD_STATUS.U.name()); |
| | | record.setOrderId(orderId); |
| | | pointGoodsRecordMapper.updateById(record); |
| | | } |
| | | |
| | | public void revertExchangeGoods(Long recordId) { |
| | | PointGoodsRecord record = pointGoodsRecordMapper.selectById(recordId); |
| | | if(record == null){ |
| | | throw new ValidationException("兑换券不存在"); |
| | | } |
| | | if(!Constants.POINT_GOODS_RECORD_STATUS.U.name().equals(record.getStatus())){ |
| | | throw new ValidationException("兑换券未使用或过期"); |
| | | } |
| | | if(SecurityUtils.getUserId() != null && !SecurityUtils.getUserId().equals(record.getUserId())){ |
| | | throw new ValidationException("兑换券不属于当前用户"); |
| | | } |
| | | record.setStatus(Constants.POINT_GOODS_RECORD_STATUS.A.name()); |
| | | record.setOrderId(null); |
| | | pointGoodsRecordMapper.updateById(record); |
| | | } |
| | | } |
| | |
| | | List<StationDTO> list = stationMapper.queryList( name); |
| | | return list; |
| | | } |
| | | |
| | | public Boolean getMainWarehouse(String userId) { |
| | | return stationMapper.selectCount(new LambdaQueryWrapper<Station>().eq(Station::getType,"0").like(Station::getUserIds, userId))>0; |
| | | } |
| | | } |
| | |
| | | //获取角色详情 |
| | | Role role = roleMapper.selectById(id); |
| | | //获取角色下的菜单 |
| | | QueryWrapper queryWrapper = new QueryWrapper<RoleMenu>().and(roleMenuQueryWrapper -> { |
| | | return roleMenuQueryWrapper |
| | | .eq("ROLE_ID", id); |
| | | }); |
| | | QueryWrapper queryWrapper = new QueryWrapper<RoleMenu>().eq("ROLE_ID", id); |
| | | List<RoleMenu> roleMenus = roleMenuMapper.selectList(queryWrapper); |
| | | |
| | | List<String> menuIds = new ArrayList<>(); |
| | |
| | | |
| | | private void addRoleMenus(String id, List<String> menuIds){ |
| | | //删除角色已存在的菜单 |
| | | QueryWrapper deleteQuery = new QueryWrapper<RoleMenu>().and(roleMenuQueryWrapper -> { |
| | | return roleMenuQueryWrapper |
| | | .eq("ROLE_ID", id); |
| | | }); |
| | | QueryWrapper deleteQuery = new QueryWrapper<RoleMenu>().eq("ROLE_ID", id); |
| | | roleMenuMapper.delete(deleteQuery); |
| | | //给角色添加可以访问的菜单 |
| | | for (String menuId : menuIds) { |
| | |
| | | roleMapper.deleteById(id); |
| | | |
| | | //删除角色关联的菜单 |
| | | QueryWrapper deleteQuery = new QueryWrapper<RoleMenu>().and(roleMenuQueryWrapper -> { |
| | | return roleMenuQueryWrapper |
| | | .eq("ROLE_ID", id); |
| | | }); |
| | | QueryWrapper deleteQuery = new QueryWrapper<RoleMenu>().eq("ROLE_ID", id); |
| | | roleMenuMapper.delete(deleteQuery); |
| | | |
| | | //删除角色关联的用户 |
| | | deleteQuery = new QueryWrapper<UserRole>().and(userRoleQueryWrapper -> { |
| | | return userRoleQueryWrapper |
| | | .eq("ROLE_ID", id); |
| | | }); |
| | | deleteQuery = new QueryWrapper<UserRole>().eq("ROLE_ID", id); |
| | | userRoleMapper.delete(deleteQuery); |
| | | } |
| | | |
| | |
| | | import com.mzl.flower.dto.response.system.MenuTreeDTO; |
| | | import com.mzl.flower.dto.response.system.UserDetailsDTO; |
| | | import com.mzl.flower.dto.response.system.UserListDTO; |
| | | import com.mzl.flower.entity.point.CustomerPoint; |
| | | import com.mzl.flower.entity.system.*; |
| | | import com.mzl.flower.enums.TrueOrFalseEnum; |
| | | import com.mzl.flower.mapper.point.CustomerPointMapper; |
| | | import com.mzl.flower.mapper.system.*; |
| | | import com.mzl.flower.service.customer.CustomerService; |
| | | import com.mzl.flower.service.partner.PartnerService; |
| | | import com.mzl.flower.service.point.CustomerPointService; |
| | | import com.mzl.flower.service.supplier.StationService; |
| | | import com.mzl.flower.service.supplier.SupplierService; |
| | | import com.mzl.flower.utils.TreeBuilderUtil; |
| | | import com.mzl.flower.utils.UUIDGenerator; |
| | |
| | | |
| | | @Autowired |
| | | private EmployeeMapper employeeMapper; |
| | | |
| | | @Autowired |
| | | private CustomerPointMapper customerPointMapper; |
| | | @Autowired |
| | | private StationService stationService; |
| | | |
| | | |
| | | public User findUserByOpenId(String openId, String sessionKey, String unionId |
| | | , String imgUrl, String nickname,String userType){ |
| | |
| | | |
| | | if(Constants.USER_TYPE.customer.name().equals(user.getType())){ |
| | | result.setCustomerDTO(customerService.getCurrentCustomer()); |
| | | //查询积分 |
| | | CustomerPoint customerPoint = customerPointMapper.selectOne(new LambdaQueryWrapper<CustomerPoint>() |
| | | .eq(CustomerPoint::getUserId, userId)); |
| | | if(customerPoint == null){ |
| | | result.setCurrentPoint(0); |
| | | }else{ |
| | | Integer currentPoint =customerPoint.getTotalPoint()-customerPoint.getUsedPoint()-customerPoint.getExpiredPoint()-customerPoint.getDeductionPoint(); |
| | | result.setCurrentPoint(currentPoint>=0?currentPoint:0); |
| | | } |
| | | }else if(Constants.USER_TYPE.supplier.name().equals(user.getType())){ |
| | | result.setSupplierDTO(supplierService.getCurrentSupplier()); |
| | | }else if(Constants.USER_TYPE.partner.name().equals(user.getType())){ |
| | | result.setPartnerDTO(partnerService.getCurrentPartner()); |
| | | }else if (Constants.USER_TYPE.admin.name().equals(user.getType())){ |
| | | result.setMainWarehouse(stationService.getMainWarehouse(user.getId())); |
| | | } |
| | | result.setBindWechat(wechatMapper.selectCount(new LambdaQueryWrapper<UserWechat>() |
| | | .eq(UserWechat::getUserId, userId)) > 0); |
| | |
| | | } |
| | | |
| | | |
| | | public List<User> getVipGradeUserList(String getVipGrade) { |
| | | QueryWrapper<User> queryWrapper=new QueryWrapper<>(); |
| | | queryWrapper.lambda().eq(User::getDeleted, TrueOrFalseEnum.FALSE.isFlag()) |
| | | .eq(User::getVipGrade,getVipGrade); |
| | | return userMapper.selectList(queryWrapper); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.utils; |
| | | |
| | | import org.springframework.beans.BeanUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | public class ConverterUtil { |
| | | |
| | | /** |
| | | * 单个对象的转换 |
| | | * @param source 源对象 |
| | | * @param targetClass 目标类的类型 |
| | | * @param <T> 源类型 |
| | | * @param <R> 目标类型 |
| | | * @return 转换后的目标对象 |
| | | */ |
| | | public static <T, R> R transObject(T source, Class<R> targetClass) { |
| | | if (source == null) { |
| | | return null; |
| | | } |
| | | try { |
| | | R targetObject = targetClass.getDeclaredConstructor().newInstance(); |
| | | BeanUtils.copyProperties(source, targetObject); |
| | | return targetObject; |
| | | } catch (Exception e) { |
| | | throw new RuntimeException("对象转换失败", e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * List对象的转换 |
| | | * @param sourceList 源List对象 |
| | | * @param targetClass 目标类的类型 |
| | | * @param <T> 源类型 |
| | | * @param <R> 目标类型 |
| | | * @return 转换后的目标List对象 |
| | | */ |
| | | public static <T, R> List<R> transList(List<T> sourceList, Class<R> targetClass) { |
| | | if (sourceList == null || sourceList.isEmpty()) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return sourceList.stream() |
| | | .filter(Objects::nonNull) |
| | | .map(sourceObject -> transObject(sourceObject, targetClass)) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | /** |
| | | * Page对象的转换 |
| | | * @param sourcePage 源Page对象 |
| | | * @param targetClass 目标类的类型 |
| | | * @param <T> 源类型 |
| | | * @param <R> 目标类型 |
| | | * @return 转换后的目标Page对象 |
| | | */ |
| | | public static <T, R> Page<R> transPage(Page<T> sourcePage, Class<R> targetClass) { |
| | | if (sourcePage == null) { |
| | | return new Page<>(); |
| | | } |
| | | |
| | | // 创建一个新的 Page 对象用于存放转换后的目标类型对象 |
| | | Page<R> targetPage = new Page<>(sourcePage.getCurrent(), sourcePage.getSize(), sourcePage.getTotal()); |
| | | |
| | | // 转换列表并设置到 Page 对象中 |
| | | List<R> targetList = transList(sourcePage.getRecords(), targetClass); |
| | | targetPage.setRecords(targetList); |
| | | return targetPage; |
| | | } |
| | | } |
| | |
| | | |
| | | import org.apache.poi.util.LocaleUtil; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Calendar; |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 将LocalDateTime对象转换为字符串 |
| | | * @return |
| | | */ |
| | | public static String toString(LocalDate date,String format) { |
| | | // 定义日期时间格式 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern(format); |
| | | String str = date.format(formatter); |
| | | return str; |
| | | } |
| | | |
| | | |
| | | |
| | | public static Date getJavaDate(double date) { |
| | | return getJavaDate(date, false, (TimeZone)null, false); |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.customer; |
| | | |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.dto.response.point.CustomerPointDetailDTO; |
| | | import com.mzl.flower.service.point.CustomerPointService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/customer/point/sign") |
| | | @Api(value = "签到-花店", tags = "签到-花店") |
| | | @Validated |
| | | @Slf4j |
| | | public class CustomerSignInController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CustomerPointService customerPointService; |
| | | |
| | | @PostMapping("/in") |
| | | @ApiOperation(value = "签到") |
| | | public ResponseEntity<ReturnDataDTO> signIn(){ |
| | | customerPointService.signIn(); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "签到历史") |
| | | public ResponseEntity<ReturnDataDTO<List<CustomerPointDetailDTO>>> signList(String startDateStr, String endDateStr) { |
| | | LocalDate startDate = LocalDate.parse(startDateStr); |
| | | LocalDate endDate = LocalDate.parse(endDateStr); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), customerPointService.signList(startDate, endDate)); |
| | | } |
| | | |
| | | @GetMapping("/sign/today") |
| | | @ApiOperation(value = "今日是否签到") |
| | | public ResponseEntity<ReturnDataDTO<Boolean>> signToday() { |
| | | return returnData(R.SUCCESS.getCode(), customerPointService.signToday()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.customer; |
| | | |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.response.payment.*; |
| | | import com.mzl.flower.service.payment.DeliveryOrderService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/customer/delivery") |
| | | @Api(value = "配送管理-花店", tags = "配送管理-花店") |
| | | @Validated |
| | | @Slf4j |
| | | public class DeliveryCustomerController extends BaseController { |
| | | |
| | | @Autowired |
| | | private DeliveryOrderService deliveryOrderService; |
| | | |
| | | @GetMapping("/mine/list/check/info/reduce") |
| | | @ApiOperation(value = "降级操作详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "orderItemId", value = "订单商品id", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckReduceDTO>> getReduceCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getReduceCheck(orderItemId)); |
| | | } |
| | | |
| | | @GetMapping("/mine/list/check/info/lack") |
| | | @ApiOperation(value = "缺货操作详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "orderItemId", value = "订单商品id", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getLackCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.lack.name(), false)); |
| | | } |
| | | } |
| | |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.dto.request.customer.CreateAddressDTO; |
| | | import com.mzl.flower.dto.request.customer.CreateFollowDTO; |
| | | import com.mzl.flower.dto.request.customer.UpdateAddressDTO; |
| | | import com.mzl.flower.dto.response.customer.FollowDTO; |
| | | import com.mzl.flower.dto.response.supplier.SupplierDTO; |
| | | import com.mzl.flower.entity.customer.Address; |
| | | import com.mzl.flower.service.customer.FollowService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/follow") |
| | |
| | | public ResponseEntity<ReturnDataDTO<Page<FollowDTO>>> myFollow(Page page) { |
| | | return returnData(R.SUCCESS.getCode(),followService.myFollow(page,SecurityUtils.getUserId())); |
| | | } |
| | | |
| | | @GetMapping("/fans/statis/{supplierId}") |
| | | @ApiOperation(value = "我的关注列表", notes = "我的关注列表") |
| | | public ResponseEntity<ReturnDataDTO<Integer>> myFansStatis(@NotNull(message = "supplierId不能为空") @PathVariable("supplierId") Long supplierId) { |
| | | return returnData(R.SUCCESS.getCode(),followService.getStatisFansCount(supplierId)); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.mzl.flower.dto.response.payment.OrderDTO; |
| | | import com.mzl.flower.dto.response.payment.OrderItemListDTO; |
| | | import com.mzl.flower.dto.response.payment.OrderListDTO; |
| | | import com.mzl.flower.entity.payment.Order; |
| | | import com.mzl.flower.service.payment.OrderService; |
| | | import com.mzl.flower.service.payment.UserPaymentV3Service; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @ApiImplicitParam(name = "id", value = "订单id", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<?>> confirmOrderReceive(String id){ |
| | | orderService.confirmOrderReceive(id); |
| | | Order o = orderService.confirmOrderReceive(id); |
| | | orderService.processAfterReceive(o); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
对比新文件 |
| | |
| | | package com.mzl.flower.web.customer; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.request.point.*; |
| | | import com.mzl.flower.dto.response.point.CustomerPointDetailDTO; |
| | | import com.mzl.flower.dto.response.point.PointGoodsDTO; |
| | | import com.mzl.flower.dto.response.point.PointGoodsListDTO; |
| | | import com.mzl.flower.dto.response.point.PointGoodsRecordDTO; |
| | | import com.mzl.flower.entity.point.PointGoodsRecord; |
| | | import com.mzl.flower.service.point.PointGoodsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/customer/point/goods") |
| | | @Api(value = "积分商品-花店", tags = "积分商品-花店") |
| | | @Validated |
| | | @Slf4j |
| | | public class PointGoodsCustomerController extends BaseController { |
| | | |
| | | @Autowired |
| | | private PointGoodsService pointGoodsService; |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "商品列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<PointGoodsListDTO>>> selectGoodsList(Page page, PointGoodsQueryDTO dto){ |
| | | dto.setStatus(Constants.POINT_GOODS_STATUS.A.name()); |
| | | return returnData(R.SUCCESS.getCode(), pointGoodsService.selectGoodsList(page, dto)); |
| | | } |
| | | |
| | | @GetMapping("/list/view") |
| | | @ApiOperation(value = "商品详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "Long", paramType = "query") |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<PointGoodsDTO>> getGoodsInfo(Long id) { |
| | | return returnData(R.SUCCESS.getCode(), pointGoodsService.getGoodsInfo(id)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/exchange") |
| | | @ApiOperation(value = "积分商品兑换", notes = "积分商品兑换") |
| | | public ResponseEntity<ReturnDataDTO> exchangeGoods(@Validated @RequestBody ExchangeGoodsDTO dto) { |
| | | pointGoodsService.exchangeGoods(dto); |
| | | return returnData(R.SUCCESS.getCode(),null); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/exchange/list") |
| | | @ApiOperation(value = "积分商品兑换券列表", notes = "积分商品兑换券列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<PointGoodsRecordDTO>>> myExchangeGoods(QueryExchangeGoodsDTO dto, Page page) { |
| | | return returnData(R.SUCCESS.getCode(), pointGoodsService.myExchangeGoods(dto,page)); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | flowerService.setFlowerShown(id, false); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PostMapping("/list/limiteds") |
| | | @ApiOperation(value = "批量设置标签") |
| | | public ResponseEntity<ReturnDataDTO> setFlowersLimited(@RequestBody FlowerLimitedDTO dto) { |
| | | flowerService.setFlowersLimited(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | } |
| | |
| | | if(user == null){ |
| | | throw new ValidationException("用户不存在"); |
| | | } |
| | | CustomerDTO currentCustomer = customerMapper.getCurrentCustomer(user.getId()); |
| | | if (ObjectUtils.isEmpty(currentCustomer)) { |
| | | throw new ValidationException("用户不存在"); |
| | | } |
| | | if (currentCustomer.getIsEnabled() == false) { |
| | | throw new ValidationException("用户已禁用,请联系管理员"); |
| | | } |
| | | String tokenCache = stringCacheClient.get(TOKEN_KEY + SEPARATOR + user.getId()); |
| | | if (StringUtils.isNotBlank(tokenCache)) { |
| | | //强制删除token,下线 |
| | |
| | | String tokenCache = stringCacheClient.get(TOKEN_KEY + SEPARATOR + user.getId()); |
| | | if (StringUtils.isNotBlank(tokenCache)) { |
| | | //强制删除token,下线 |
| | | removeToken(tokenCache,user.getId()); |
| | | // removeToken(tokenCache,user.getId()); |
| | | } |
| | | try { |
| | | PartnerAuthenticationToken authRequest = new PartnerAuthenticationToken(username, password); |
| | |
| | | if(user == null){ |
| | | throw new ValidationException("用户不存在"); |
| | | } |
| | | PartnerDTO partnerDTO = partnerMapper.getCurrentPartner(user.getId()); |
| | | if (ObjectUtils.isEmpty(partnerDTO)) { |
| | | throw new ValidationException("用户不存在"); |
| | | } |
| | | if (partnerDTO.getIsEnabled() == false) { |
| | | throw new ValidationException("用户已禁用,请联系管理员"); |
| | | } |
| | | String tokenCache = stringCacheClient.get(TOKEN_KEY + SEPARATOR + user.getId()); |
| | | if (StringUtils.isNotBlank(tokenCache)) { |
| | | //强制删除token,下线 |
| | | removeToken(tokenCache,user.getId()); |
| | | // removeToken(tokenCache,user.getId()); |
| | | } |
| | | try { |
| | | PhoneAuthenticationToken authRequest = new PhoneAuthenticationToken(tel, smsCode, Constants.USER_TYPE.partner.name()); |
| | |
| | | throw new ValidationException("用户不存在"); |
| | | } |
| | | SupplierDTO supplierDTO = supplierMapper.getCurrentSupplier(user.getId()); |
| | | if (ObjectUtils.isEmpty(supplierDTO)) { |
| | | throw new ValidationException("用户不存在"); |
| | | } |
| | | if (supplierDTO.getIsEnabled() == false) { |
| | | if (supplierDTO != null && supplierDTO.getIsEnabled() == false) { |
| | | throw new ValidationException("用户已禁用,请联系管理员"); |
| | | } |
| | | String tokenCache = stringCacheClient.get(TOKEN_KEY + SEPARATOR + user.getId()); |
| | |
| | | if(user == null){ |
| | | throw new ValidationException("用户不存在"); |
| | | } |
| | | SupplierDTO supplierDTO = supplierMapper.getCurrentSupplier(user.getId()); |
| | | if (ObjectUtils.isEmpty(supplierDTO)) { |
| | | throw new ValidationException("用户不存在"); |
| | | } |
| | | if (supplierDTO.getIsEnabled() == false) { |
| | | throw new ValidationException("用户已禁用,请联系管理员"); |
| | | } |
| | | String tokenCache = stringCacheClient.get(TOKEN_KEY + SEPARATOR + user.getId()); |
| | | if (StringUtils.isNotBlank(tokenCache)) { |
| | | //强制删除token,下线 |
对比新文件 |
| | |
| | | package com.mzl.flower.web.member; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.dto.request.menber.*; |
| | | import com.mzl.flower.dto.response.member.MemberGrowthRecordVO; |
| | | import com.mzl.flower.dto.response.member.MemberVO; |
| | | import com.mzl.flower.dto.response.member.UserGrowthRecordVO; |
| | | import com.mzl.flower.service.menber.MemberGrowthRecordService; |
| | | import com.mzl.flower.service.menber.MemberService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * @author fanghaowei |
| | | * @version version2.0 |
| | | * @className MemberController |
| | | * @date 2024/8/26 |
| | | * @description 会员管理功能开发 |
| | | */ |
| | | @Api(value = "会员管理", tags = "会员管理") |
| | | @RestController |
| | | @RequestMapping("/api") |
| | | @RequiredArgsConstructor |
| | | public class MemberController extends BaseController { |
| | | |
| | | private final MemberService memberService; |
| | | |
| | | private final MemberGrowthRecordService memberGrowthRecordService; |
| | | |
| | | @GetMapping("/member/list") |
| | | @ApiOperation(value = "会员列表", httpMethod = "GET") |
| | | public ResponseEntity<ReturnDataDTO<Page<MemberVO>>> getMemberList(Page page, MemberQueryDTO dto) { |
| | | return returnData(R.SUCCESS.getCode(), memberService.queryPage(dto, page)); |
| | | } |
| | | |
| | | @GetMapping(value = "/member/delete") |
| | | @ApiOperation(value = "删除会员 ", httpMethod = "GET", notes = "ID") |
| | | public ResponseEntity delete(@NotNull(message = "id不能为空") Long id) { |
| | | memberService.deleteMember(String.valueOf(id)); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PostMapping(value = "/member/new") |
| | | @ApiOperation(value = "保存会员", httpMethod = "POST") |
| | | public ResponseEntity insert(@RequestBody MemberDTO memberDTO) { |
| | | memberService.saveMember(memberDTO); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PostMapping(value = "/member/edit") |
| | | @ApiOperation(value = "更新会员", httpMethod = "POST") |
| | | public ResponseEntity update(@RequestBody MemberDTO memberDTO) { |
| | | memberService.updateMember(memberDTO); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/memberGrowthRecord/list") |
| | | @ApiOperation(value = "会员记录列表", httpMethod = "POST") |
| | | public ResponseEntity<ReturnDataDTO<Page<MemberGrowthRecordVO>>> getMemberRecordList(Page page, MemberRecordQueryDTO dto) { |
| | | return returnData(R.SUCCESS.getCode(), memberGrowthRecordService.queryPage(dto, page)); |
| | | } |
| | | |
| | | @GetMapping("/getmemberGrowthRecord/list") |
| | | @ApiOperation(value = "会员记录列表", httpMethod = "GET") |
| | | public ResponseEntity<ReturnDataDTO<Page<MemberGrowthRecordVO>>> getmemberGrowthRecord(Page page, MemberRecordQueryDTO dto) { |
| | | return returnData(R.SUCCESS.getCode(), memberGrowthRecordService.queryPage(dto, page)); |
| | | } |
| | | |
| | | @GetMapping(value = "/memberGrowthRecord/delete") |
| | | @ApiOperation(value = "删除会员记录 ", httpMethod = "GET", notes = "ID") |
| | | public ResponseEntity deleteGrowthRecord(@NotNull(message = "id不能为空") Long id) { |
| | | memberGrowthRecordService.deleteMemberGrowthRecord(String.valueOf(id)); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PostMapping(value = "/memberGrowthRecord/new") |
| | | @ApiOperation(value = "保存会员记录", httpMethod = "POST") |
| | | public ResponseEntity insertGrowthRecord(@RequestBody MemberGrowthRecordDTO memberGrowthRecordDTO) { |
| | | memberGrowthRecordService.saveMemberGrowthRecord(memberGrowthRecordDTO); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PostMapping(value = "/memberGrowthRecord/edit") |
| | | @ApiOperation(value = "更新会员记录", httpMethod = "POST") |
| | | public ResponseEntity updateGrowthRecord(@Validated @RequestBody MemberGrowthRecordDTO memberGrowthRecordDTO) { |
| | | memberGrowthRecordService.updateMemberGrowthRecord(memberGrowthRecordDTO); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping(value = "/member/info/{userId}") |
| | | @ApiOperation(value = "当前用户会员信息 ", httpMethod = "GET", notes = "ID") |
| | | public ResponseEntity memberInfo(@PathVariable("userId") Long userId) { |
| | | UserGrowthRecordDTO userGrowthRecordDTO = memberGrowthRecordService.getInfoByUserId(String.valueOf(userId)); |
| | | return returnData(R.SUCCESS.getCode(), userGrowthRecordDTO); |
| | | } |
| | | |
| | | @GetMapping(value = "/app/member/info") |
| | | @ApiOperation(value = "当前用户会员信息 ", httpMethod = "GET", notes = "ID") |
| | | public ResponseEntity memberInfo2() { |
| | | UserGrowthRecordDTO userGrowthRecordDTO = memberGrowthRecordService.getInfoByUserId(SecurityUtils.getUserId()); |
| | | return returnData(R.SUCCESS.getCode(), userGrowthRecordDTO); |
| | | } |
| | | |
| | | @GetMapping("/userGrowthRecord/list") |
| | | @ApiOperation(value = "会员用户记录列表", httpMethod = "GET") |
| | | public ResponseEntity<ReturnDataDTO<Page<UserGrowthRecordVO>>> getUserMemberRecordList(Page page, UserMemberRecordQueryDTO dto) { |
| | | return returnData(R.SUCCESS.getCode(), memberGrowthRecordService.queryUserPage(dto, page)); |
| | | } |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "查询订单清单列表-按库位分商品") |
| | | public ResponseEntity<ReturnDataDTO<List<OrderCheckLocationListDTO>>> selectOrderCheckLocationList( |
| | | @RequestBody OrderQueryDTO dto){ |
| | | Partner partner = orderService.getCurrentPartner(); |
| | | dto.setPartnerId(partner.getId()); |
| | | return returnData(R.SUCCESS.getCode(), orderService.selectOrderCheckLocationList(dto)); |
| | | } |
| | | } |
| | |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.request.payment.*; |
| | | import com.mzl.flower.dto.response.flower.StationStatisticDTO; |
| | | import com.mzl.flower.dto.response.payment.*; |
| | | import com.mzl.flower.service.payment.DeliveryOrderService; |
| | | import io.micrometer.core.instrument.util.StringUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | |
| | | @GetMapping("/station/list") |
| | | @ApiOperation(value = "查询我的集货站列表") |
| | | public ResponseEntity<ReturnDataDTO<List<StationStatisticDTO>>> statisticStationList(String name){ |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime towAm = LocalDate.now().atTime(2, 0, 0); |
| | | LocalDateTime fivePm = LocalDate.now().atTime(17, 0, 0); |
| | | public ResponseEntity<ReturnDataDTO<List<StationStatisticDTO>>> statisticStationList(String name |
| | | , String status, String date){ |
| | | /*if(StringUtils.isEmpty(date)){ |
| | | throw new ValidationException("请选择日期"); |
| | | }*/ |
| | | LocalDateTime startDate; |
| | | LocalDateTime endDate; |
| | | if(now.isAfter(towAm)){ |
| | | startDate = fivePm.plusDays(-1); |
| | | endDate = fivePm; |
| | | LocalDate localDate = deliveryOrderService.parseLocalDate(date); |
| | | if(localDate != null){ |
| | | endDate = localDate.atTime(17, 0, 0); |
| | | startDate = endDate.plusDays(-1); |
| | | } else { |
| | | startDate = fivePm.plusDays(-2); |
| | | endDate = fivePm.plusDays(-1); |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime towAm = LocalDate.now().atTime(2, 0, 0); |
| | | LocalDateTime fivePm = LocalDate.now().atTime(17, 0, 0); |
| | | if(now.isAfter(towAm)){ |
| | | startDate = fivePm.plusDays(-1); |
| | | endDate = fivePm; |
| | | } else { |
| | | startDate = fivePm.plusDays(-2); |
| | | endDate = fivePm.plusDays(-1); |
| | | } |
| | | } |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.statisticStationList(name,startDate,endDate)); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.statisticStationList(name, startDate, endDate, status)); |
| | | } |
| | | |
| | | |
| | |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getDeliveryOrderItem(id)); |
| | | } |
| | | |
| | | @PostMapping("/list/items/views") |
| | | @ApiOperation(value = "获取商品详情列表") |
| | | public ResponseEntity<ReturnDataDTO<List<DeliveryOrderItemDTO>>> getDeliveryOrderItem(@RequestBody PostQueryDTO dto){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getDeliveryOrderItems(dto)); |
| | | } |
| | | |
| | | //////////////////////////////////////////////////////////新接口 |
| | | @GetMapping("/check/list") |
| | | @ApiOperation(value = "查询集货站供应商配送列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<DeliveryOrderList4CheckDTO>>> selectSupplierDoList4Check(Page page |
| | | , DeliveryOrderStationQueryDTO dto){ |
| | | String date = dto.getDate(); |
| | | if(StringUtils.isEmpty(date)){ |
| | | throw new ValidationException("请选择日期"); |
| | | } |
| | | LocalDate localDate = deliveryOrderService.parseLocalDate(date); |
| | | if(localDate != null){ |
| | | LocalDateTime end = localDate.atTime(17, 0, 0); |
| | | LocalDateTime begin = end.plusDays(-1); |
| | | dto.setStartDate(begin); |
| | | dto.setEndDate(end); |
| | | } |
| | | |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.selectSupplierDoList4Check(page, dto)); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "查询供应商配送单列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<DeliveryOrder4CheckDTO>>> selectSupplierDoInfo4Check(Page page |
| | | , DeliveryOrderInfoSpQueryDTO dto){ |
| | | String date = dto.getDate(); |
| | | if(StringUtils.isEmpty(date)){ |
| | | throw new ValidationException("请选择日期"); |
| | | } |
| | | LocalDate localDate = deliveryOrderService.parseLocalDate(date); |
| | | if(localDate != null){ |
| | | LocalDateTime end = localDate.atTime(17, 0, 0); |
| | | LocalDateTime begin = end.plusDays(-1); |
| | | dto.setStartDate(begin); |
| | | dto.setEndDate(end); |
| | | } |
| | | |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.selectSupplierDoInfo4Check(page, dto)); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "补货操作详情") |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getReplaceCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.replace.name())); |
| | | , Constants.CHECK_TYPE.replace.name(), false)); |
| | | } |
| | | |
| | | @GetMapping("/check/info/lack") |
| | | @ApiOperation(value = "缺货操作详情") |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getLackCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.lack.name())); |
| | | , Constants.CHECK_TYPE.lack.name(), false)); |
| | | } |
| | | |
| | | @PostMapping("/check/info/do/reduce") |
| | |
| | | } |
| | | |
| | | @GetMapping("/check/list/complete") |
| | | @ApiOperation(value = "一键质检(只能完成当天的,且必须点一下才会修改订单状态)") |
| | | @ApiOperation(value = "一键质检") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "供应商id", required = true, dataType = "Long", paramType = "query") |
| | | @ApiImplicitParam(name = "id", value = "供应商id", required = true, dataType = "Long", paramType = "query"), |
| | | @ApiImplicitParam(name = "date", value = "日期(yyyy-MM-dd)", required = true, dataType = "String", paramType = "query"), |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO> completeCheck(Long id) { |
| | | public ResponseEntity<ReturnDataDTO> completeCheck(Long id, String date) { |
| | | if(StringUtils.isEmpty(date)){ |
| | | throw new ValidationException("请选择日期"); |
| | | } |
| | | LocalDateTime startDate = null; |
| | | LocalDateTime endDate = null; |
| | | LocalDate localDate = deliveryOrderService.parseLocalDate(date); |
| | | if(localDate != null){ |
| | | endDate = localDate.atTime(17, 0, 0); |
| | | startDate = endDate.plusDays(-1); |
| | | } |
| | | |
| | | List<String> orderIds = deliveryOrderService.completeSupplierCheck(id, startDate, endDate); |
| | | deliveryOrderService.checkOrdersStatus(orderIds); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/check/list/complete/today") |
| | | @ApiOperation(value = "一键质检(今日)") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "供应商id", required = true, dataType = "Long", paramType = "query"), |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO> completeCheckToday(Long id) { |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | LocalDateTime towAm = LocalDate.now().atTime(2, 0, 0); |
| | | LocalDateTime fivePm = LocalDate.now().atTime(17, 0, 0); |
| | |
| | | startDate = fivePm.plusDays(-2); |
| | | endDate = fivePm.plusDays(-1); |
| | | } |
| | | |
| | | List<String> orderIds = deliveryOrderService.completeSupplierCheck(id, startDate, endDate); |
| | | deliveryOrderService.checkOrdersStatus(orderIds); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getReplaceCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.replace.name())); |
| | | , Constants.CHECK_TYPE.replace.name(), false)); |
| | | } |
| | | |
| | | @GetMapping("/list/check/info/lack") |
| | |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getLackCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.lack.name())); |
| | | , Constants.CHECK_TYPE.lack.name(), false)); |
| | | } |
| | | |
| | | @GetMapping("/list/check/info/agree") |
对比新文件 |
| | |
| | | package com.mzl.flower.web.point; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.dto.request.point.ChangePointDTO; |
| | | import com.mzl.flower.dto.request.point.QueryCustomerPointDTO; |
| | | import com.mzl.flower.dto.request.point.QueryPointDetailDTO; |
| | | import com.mzl.flower.dto.request.supplier.UpdateSupplierDTO; |
| | | import com.mzl.flower.dto.response.content.AdvertisementDTO; |
| | | import com.mzl.flower.dto.response.point.CustomerPointDTO; |
| | | import com.mzl.flower.dto.response.point.CustomerPointDetailDTO; |
| | | import com.mzl.flower.service.point.CustomerPointService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.ValidationException; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.util.List; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/customer/point") |
| | | @Api(value = "会员积分", tags = "会员积分") |
| | | @Validated |
| | | @Slf4j |
| | | public class CustomerPointController extends BaseController { |
| | | |
| | | |
| | | private final CustomerPointService customerPointService; |
| | | |
| | | public CustomerPointController(CustomerPointService customerPointService) { |
| | | this.customerPointService = customerPointService; |
| | | } |
| | | |
| | | |
| | | @GetMapping("/page/list") |
| | | @ApiOperation(value = "管理端-积分详细记录列表", notes = "管理端-商户积分详细记录列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<CustomerPointDetailDTO>>> queryCustomerDetails(QueryPointDetailDTO dto, Page page) { |
| | | if(dto.getCustomerId() == null || dto.getCustomerId() == 0){ |
| | | throw new ValidationException("商户ID不能为空"); |
| | | } |
| | | return returnData(R.SUCCESS.getCode(),customerPointService.queryCustomerDetails(dto, page)); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "管理端-积分查询", notes = "用户端-积分查询") |
| | | public ResponseEntity<ReturnDataDTO<Page<CustomerPointDTO>>> queryPage(QueryCustomerPointDTO dto, Page page) { |
| | | return returnData(R.SUCCESS.getCode(), customerPointService.queryPage(dto, page)); |
| | | } |
| | | |
| | | @PostMapping("/giveaway") |
| | | @ApiOperation(value = "管理端-积分赠送", notes = "管理端-积分赠送") |
| | | public ResponseEntity<ReturnDataDTO> giveawayPoint(@Validated @RequestBody ChangePointDTO dto) { |
| | | if(dto.getPoint()<=0){ |
| | | throw new ValidationException("赠送积分必须大于0"); |
| | | } |
| | | customerPointService.giveawayPoint(dto); |
| | | return returnData(R.SUCCESS.getCode(),null); |
| | | } |
| | | |
| | | @PostMapping("/deduction") |
| | | @ApiOperation(value = "管理端-积分扣除", notes = "管理端-积分扣除") |
| | | public ResponseEntity<ReturnDataDTO> deductionPoint(@Validated @RequestBody ChangePointDTO dto) { |
| | | if(dto.getPoint()<=0){ |
| | | throw new ValidationException("扣除积分必须大于0"); |
| | | } |
| | | customerPointService.deductionPoint(dto); |
| | | return returnData(R.SUCCESS.getCode(),null); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "用户端-积分列表(花店积分列表)", notes = "管理端-积分列表(花店积分列表)") |
| | | public ResponseEntity<ReturnDataDTO<Page<CustomerPointDetailDTO>>> myPointDetails(QueryPointDetailDTO dto, Page page) { |
| | | dto.setUserId(SecurityUtils.getUserId()); |
| | | return returnData(R.SUCCESS.getCode(),customerPointService.queryCustomerDetails(dto, page)); |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.point; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.request.point.PointGoodsCreateDTO; |
| | | import com.mzl.flower.dto.request.point.PointGoodsQueryDTO; |
| | | import com.mzl.flower.dto.request.point.PointGoodsUpdateDTO; |
| | | import com.mzl.flower.dto.response.point.PointGoodsDTO; |
| | | import com.mzl.flower.dto.response.point.PointGoodsListDTO; |
| | | import com.mzl.flower.service.point.PointGoodsService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api/point/goods") |
| | | @Api(value = "积分商品管理-运营端", tags = "积分商品管理-运营端") |
| | | @Validated |
| | | @Slf4j |
| | | public class PointGoodsController extends BaseController { |
| | | |
| | | @Autowired |
| | | private PointGoodsService pointGoodsService; |
| | | |
| | | @PostMapping("/list/new") |
| | | @ApiOperation(value = "新增商品") |
| | | public ResponseEntity<ReturnDataDTO> addPointGoods(@RequestBody PointGoodsCreateDTO dto) { |
| | | return returnData(R.SUCCESS.getCode(), pointGoodsService.addPointGoods(dto)); |
| | | } |
| | | |
| | | @PostMapping("/list/edit") |
| | | @ApiOperation(value = "编辑商品") |
| | | public ResponseEntity<ReturnDataDTO> updatePointGoods(@RequestBody PointGoodsUpdateDTO dto) { |
| | | return returnData(R.SUCCESS.getCode(), pointGoodsService.updatePointGoods(dto)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "商品列表") |
| | | public ResponseEntity<ReturnDataDTO<Page<PointGoodsListDTO>>> selectGoodsList(Page page, PointGoodsQueryDTO dto){ |
| | | return returnData(R.SUCCESS.getCode(), pointGoodsService.selectGoodsList(page, dto)); |
| | | } |
| | | |
| | | @GetMapping("/list/view") |
| | | @ApiOperation(value = "商品详情") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "Long", paramType = "query") |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<PointGoodsDTO>> getGoodsInfo(Long id) { |
| | | return returnData(R.SUCCESS.getCode(), pointGoodsService.getGoodsInfo(id)); |
| | | } |
| | | |
| | | @GetMapping("/list/delete") |
| | | @ApiOperation(value = "商品删除") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<?>> deletePointGoods(String id) { |
| | | pointGoodsService.deletePointGoods(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/list/on") |
| | | @ApiOperation(value = "商品上架") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<?>> upGoods(String id) { |
| | | pointGoodsService.updateStatus(id, Constants.POINT_GOODS_STATUS.A.name()); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/list/off") |
| | | @ApiOperation(value = "商品下架") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "商品id", required = true, dataType = "String", paramType = "query") |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<?>> offGoods(String id) { |
| | | pointGoodsService.updateStatus(id, Constants.POINT_GOODS_STATUS.I.name()); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | } |
| | |
| | | if(StringUtils.isNotBlank(userId)){ |
| | | supplierDetail.setFollowed(followService.followed(userId, id)); |
| | | } |
| | | |
| | | supplierDetail.setFans(followService.fansCount(supplierDetail.getId())); |
| | | } |
| | | return returnData(R.SUCCESS.getCode(),supplierDetail); |
| | | } |
| | |
| | | import com.mzl.flower.constant.Constants; |
| | | import com.mzl.flower.dto.request.payment.DeliveryOrderArriveDTO; |
| | | import com.mzl.flower.dto.request.payment.DeliveryOrderQueryDTO; |
| | | import com.mzl.flower.dto.request.payment.PostQueryDTO; |
| | | import com.mzl.flower.dto.response.payment.*; |
| | | import com.mzl.flower.dto.response.supplier.SupplierOrderDTO; |
| | | import com.mzl.flower.service.payment.DeliveryOrderService; |
| | |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getSupplierDeliveryOrderItem(id)); |
| | | } |
| | | |
| | | @PostMapping("/list/items/views") |
| | | @ApiOperation(value = "获取商品详情列表") |
| | | public ResponseEntity<ReturnDataDTO<List<DeliveryOrderItemDTO>>> getSupplierDeliveryOrderItems(@RequestBody PostQueryDTO dto){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getSupplierDeliveryOrderItems(dto)); |
| | | } |
| | | |
| | | @PostMapping("/list/arrive") |
| | | @ApiOperation(value = "确认入位") |
| | | public ResponseEntity<ReturnDataDTO> arrived(@RequestBody DeliveryOrderArriveDTO dto) { |
| | |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getReplaceCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.replace.name())); |
| | | , Constants.CHECK_TYPE.replace.name(), true)); |
| | | } |
| | | |
| | | @GetMapping("/mine/list/check/info/lack") |
| | |
| | | }) |
| | | public ResponseEntity<ReturnDataDTO<OrderItemCheckNumDTO>> getLackCheck(String orderItemId){ |
| | | return returnData(R.SUCCESS.getCode(), deliveryOrderService.getOtherCheck(orderItemId |
| | | , Constants.CHECK_TYPE.lack.name())); |
| | | , Constants.CHECK_TYPE.lack.name(), true)); |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponRecordDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponRecordDTO; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordResultVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponRecordVO; |
| | | import com.mzl.flower.entity.coupon.CouponRecordDO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.enums.CouponStatusEnum; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-27 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/v2/coupon-record") |
| | | @Api(value = "优惠券记录管理-活动", tags = "优惠券记录管理") |
| | | @Validated |
| | | public class CouponRecordController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponRecordService couponRecordService; |
| | | |
| | | @Autowired |
| | | private CouponTemplateService2 couponTemplateService; |
| | | |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponRecordDTO dto) { |
| | | |
| | | final CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getCouponId()); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) && couponTemplateDO.getStatus().equals(CouponStatusEnum.INACTIVE.getStatus())){ |
| | | throw new ValidationException("优惠券还未发布"); |
| | | } |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) && couponTemplateDO.getStatus().equals(CouponStatusEnum.EXPIRED.getStatus())){ |
| | | throw new ValidationException("优惠券已下架"); |
| | | } |
| | | |
| | | couponRecordService.createCouponRecord(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@PathVariable String id,@Validated @RequestBody CreateCouponRecordDTO dto) { |
| | | |
| | | dto.setId(id); |
| | | |
| | | CouponRecordDO couponRecordDO= couponRecordService.getById(dto.getId()); |
| | | if(null==couponRecordDO){ |
| | | throw new ValidationException("优惠券记录不存在"); |
| | | } |
| | | |
| | | return returnData(R.SUCCESS.getCode(), couponRecordService.updateCouponRecord(dto)); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id ) { |
| | | |
| | | CouponRecordDO couponRecordDO= couponRecordService.getById(id); |
| | | if(null==couponRecordDO){ |
| | | throw new ValidationException("优惠券记录不存在"); |
| | | } |
| | | couponRecordService.deleteCouponRecord(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | CouponRecordVO couponRecordVO=couponRecordService.getCouponRecordById(id); |
| | | return returnData(R.SUCCESS.getCode(),ConverterUtil.transObject(couponRecordVO, CouponRecordResultVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponRecordVO>>> page( |
| | | Page page, QueryCouponRecordDTO dto |
| | | ) { |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(couponRecordService.getPage(page,dto), CouponRecordResultVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponRecordVO>>> list(QueryCouponRecordDTO dto |
| | | ) { |
| | | return returnData(R.SUCCESS.getCode(),ConverterUtil.transList(couponRecordService.getList(dto), CouponRecordResultVO.class)); |
| | | |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateActivyVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplatePointVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.enums.*; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/coupon/avtivy") |
| | | @Api(value = "优惠券管理-活动", tags = "优惠券管理-活动") |
| | | @Validated |
| | | public class CouponTemplateActivyController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponTemplateService2 couponTemplateService; |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponTemplateActivyDTO dto) { |
| | | |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成活动优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | couponTemplateBO.setGetUserType(CouponGetUserTypeEnum.ALL.getType()); |
| | | |
| | | |
| | | couponTemplateService.createCouponTemplate(couponTemplateBO); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | |
| | | |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@PathVariable String id,@Validated @RequestBody CreateCouponTemplateActivyDTO dto) { |
| | | |
| | | // 手动设置id值 |
| | | dto.setId(id); |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getId()); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(couponTemplateDO,couponTemplateBO); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成活动优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | couponTemplateBO.setGetUserType(CouponGetUserTypeEnum.ALL.getType()); |
| | | |
| | | couponTemplateService.updateCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | couponTemplateService.deleteCouponTemplate(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | CouponTemplateVO couponTemplateVO = couponTemplateService.getDetailById(id); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(couponTemplateVO, CouponTemplateActivyVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplatePointVO>>> page(Page page, QueryCouponDTO dto) { |
| | | // 设置只查询活动优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | Page<CouponTemplateVO> resultPage = couponTemplateService.getPage(page, dto); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplateActivyVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> list(QueryCouponDTO dto) { |
| | | // 设置只查询活动优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getList(dto), CouponTemplateActivyVO.class)); |
| | | } |
| | | |
| | | |
| | | @PutMapping("/active/{id}") |
| | | @ApiOperation(value = "发布", notes = "发布") |
| | | public ResponseEntity<ReturnDataDTO> active(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | // 判断当前时间是否在优惠券的领取时间范围内 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // if (couponTemplateDO.getGetStartDate() != null && couponTemplateDO.getGetEndDate() != null) { |
| | | // if (now.isBefore(couponTemplateDO.getGetStartDate()) || now.isAfter(couponTemplateDO.getGetEndDate())) { |
| | | // throw new ValidationException("当前时间不在优惠券领取时间范围内,不能发布优惠券。"); |
| | | // } |
| | | // } else { |
| | | // throw new ValidationException("优惠券的领取时间未设置。"); |
| | | // } |
| | | |
| | | // 检查结束时间是否存在 |
| | | if (couponTemplateDO.getGetEndDate() != null) { |
| | | // 如果当前时间小于结束时间,允许发布 |
| | | if (now.isAfter(couponTemplateDO.getGetEndDate())) { |
| | | throw new ValidationException("当前时间已超过优惠券领取结束时间,不能发布优惠券。"); |
| | | } |
| | | } else { |
| | | throw new ValidationException("优惠券的领取结束时间未设置。"); |
| | | } |
| | | |
| | | |
| | | couponTemplateService.activeCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/expire/{id}") |
| | | @ApiOperation(value = "下架", notes = "下架") |
| | | public ResponseEntity<ReturnDataDTO> expire(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.expireCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | private void valid(CreateCouponTemplateActivyDTO dto){ |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getCouponDiscountValue().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ValidationException("折扣金额必须大于0"); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) |
| | | && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | // 领取后 固定时间 |
| | | if(StringUtils.isNotBlank(dto.getUsageType()) && dto.getUsageType().equals(CouponUsageTypeEnum.FIXED.getType()) ){ |
| | | // 如果使用时间是固定时间的话,那么固定时间的开始时间和结束时间就不能为空 |
| | | if(dto.getUsageStartDate()==null){ |
| | | throw new ValidationException("固定时间开始日期不能为空"); |
| | | } |
| | | if(dto.getUsageEndDate()==null){ |
| | | throw new ValidationException("固定时间结束日期不能为空"); |
| | | } |
| | | } |
| | | |
| | | // 领取后 有效时间 |
| | | if(StringUtils.isNotBlank(dto.getUsageType()) && dto.getUsageType().equals(CouponUsageTypeEnum.GET_AFTER_TIME.getType())){ |
| | | // 如果使用时间是领取后有效时间的话,那么领取后的时间类型不能为空,且时间不能为空 |
| | | if(StringUtils.isBlank(dto.getUsageTimeType())){ |
| | | throw new ValidationException("领取后有效时间类型(COUPON_USAGE_TIME_TYPE)不能为空"); |
| | | } |
| | | |
| | | if(dto.getUsageTimeNum()==null){ |
| | | throw new ValidationException("领取后有效时间整数不能为空"); |
| | | } |
| | | if(dto.getUsageTimeNum()<=0){ |
| | | throw new ValidationException("领取后有效时间整数需要大于0"); |
| | | } |
| | | } |
| | | |
| | | // 用户获取的类型是首页领取的话 |
| | | if(StringUtils.isNotBlank(dto.getGetType()) && dto.getGetType().equals(dto.getGetType().equals(CouponGetTypeEnum.HOME.getType())) |
| | | ){ |
| | | // 优惠券图片校验 |
| | | if(StringUtils.isBlank(dto.getImageUrl())){ |
| | | throw new ValidationException("优惠券图片不能为空"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.config.security.SecurityUtils; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponRecordAppDTO; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponRecordDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryActivityEffectCouponDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryMineCouponRecordDTO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateAppVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.dto.response.customer.CustomerDTO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.enums.CouponCategoryEnum; |
| | | import com.mzl.flower.enums.CouponGetTypeEnum; |
| | | import com.mzl.flower.enums.CouponStatusEnum; |
| | | import com.mzl.flower.enums.CouponUsedStatusEnum; |
| | | import com.mzl.flower.mapper.customer.CustomerMapper; |
| | | import com.mzl.flower.service.coupon.CouponRecordService; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/coupon/app") |
| | | @Api(value = "优惠券管理-小程序", tags = "优惠券管理-小程序") |
| | | @Validated |
| | | public class CouponTemplateAppController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponTemplateService2 couponTemplateService; |
| | | |
| | | @Autowired |
| | | CouponRecordService couponRecordService; |
| | | |
| | | |
| | | @Autowired |
| | | CustomerMapper customerMapper; |
| | | |
| | | // @GetMapping("/home/list") |
| | | // @ApiOperation(value = "查询-首页弹框", notes = "查询-首页弹框") |
| | | // public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> homeList(QueryActivityEffectCouponDTO dto) { |
| | | // // 活动优惠券 |
| | | // dto.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | // // 已经发布 |
| | | // dto.setStatus(CouponStatusEnum.ACTIVE.getStatus()); |
| | | // // 首页弹窗 |
| | | // dto.setGetType(CouponGetTypeEnum.HOME.getType()); |
| | | // return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getActivityEffectList(dto), CouponTemplateAppVO.class)); |
| | | // } |
| | | |
| | | @GetMapping("/home/alert") |
| | | @ApiOperation(value = "查询-首页弹框", notes = "查询-首页弹框") |
| | | public ResponseEntity<ReturnDataDTO<CouponTemplateVO>> homeAlert(QueryActivityEffectCouponDTO dto) { |
| | | // 活动优惠券 |
| | | dto.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | // 已经发布 |
| | | dto.setStatus(CouponStatusEnum.ACTIVE.getStatus()); |
| | | // 首页弹窗 |
| | | dto.setGetType(CouponGetTypeEnum.HOME.getType()); |
| | | // 如果当前人员已经领取过的话,则不返回 |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(couponTemplateService.getHomeActivityEffectAlert(dto), CouponTemplateAppVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/activy/list") |
| | | @ApiOperation(value = "查询-活动入口", notes = "查询-活动入口") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> activyList(QueryActivityEffectCouponDTO dto) { |
| | | // 活动优惠券 |
| | | dto.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | // 已经发布 |
| | | dto.setStatus(CouponStatusEnum.ACTIVE.getStatus()); |
| | | // 活动入口 |
| | | dto.setGetType(CouponGetTypeEnum.ACTIVITY.getType()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getActivityEffectList(dto), CouponTemplateAppVO.class)); |
| | | |
| | | } |
| | | |
| | | @GetMapping("/center/list") |
| | | @ApiOperation(value = "查询-领券中心", notes = "查询-领券中心") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> centerList(QueryActivityEffectCouponDTO dto) { |
| | | // 活动优惠券 |
| | | dto.setCategory(CouponCategoryEnum.ACTIVITY.getStatus()); |
| | | // 已经发布 |
| | | dto.setStatus(CouponStatusEnum.ACTIVE.getStatus()); |
| | | // 首页弹窗 |
| | | dto.setGetType(CouponGetTypeEnum.CENTER.getType()); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getActivityEffectList(dto), CouponTemplateAppVO.class)); |
| | | |
| | | } |
| | | |
| | | @GetMapping("/mine/unused/list") |
| | | @ApiOperation(value = "我的优惠券-未使用", notes = "我的优惠券-未使用") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> unusedList(QueryMineCouponRecordDTO dto) { |
| | | // 未使用 |
| | | dto.setStatus(CouponUsedStatusEnum.UNUSED.getType()); |
| | | dto.setUserId(SecurityUtils.getUserId()); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponRecordService.getMineCouponRecordList(dto), CouponTemplateAppVO.class)); |
| | | |
| | | } |
| | | @GetMapping("/mine/used/list") |
| | | @ApiOperation(value = "我的优惠券-已使用", notes = "我的优惠券-已使用") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> usedList(QueryMineCouponRecordDTO dto) { |
| | | |
| | | // 已使用 |
| | | dto.setStatus(CouponUsedStatusEnum.USED.getType()); |
| | | dto.setUserId(SecurityUtils.getUserId()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponRecordService.getMineCouponRecordList(dto), CouponTemplateAppVO.class)); |
| | | |
| | | } |
| | | |
| | | @GetMapping("/mine/expired/list") |
| | | @ApiOperation(value = "我的优惠券-已过期", notes = "我的优惠券-已过期") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> expiredList(QueryMineCouponRecordDTO dto) { |
| | | // 已过期 |
| | | dto.setStatus(CouponUsedStatusEnum.EXPIRED.getType()); |
| | | dto.setUserId(SecurityUtils.getUserId()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponRecordService.getMineCouponRecordList(dto), CouponTemplateAppVO.class)); |
| | | |
| | | } |
| | | |
| | | @PostMapping("/receive") |
| | | @ApiOperation(value = "优惠券领取", notes = "优惠券领取") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponRecordAppDTO dto) { |
| | | |
| | | final CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getCouponId()); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) && couponTemplateDO.getStatus().equals(CouponStatusEnum.INACTIVE.getStatus())){ |
| | | throw new ValidationException("优惠券还未发布"); |
| | | } |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) && couponTemplateDO.getStatus().equals(CouponStatusEnum.EXPIRED.getStatus())){ |
| | | throw new ValidationException("优惠券已下架"); |
| | | } |
| | | |
| | | // 根据当前获取获取商户的ID |
| | | CustomerDTO currentCustomer = customerMapper.getCurrentCustomer(SecurityUtils.getUserId()); |
| | | if(null==currentCustomer){ |
| | | throw new ValidationException("当前登录的用户记录不存在"); |
| | | } |
| | | // 设置当前用户为登录用户 |
| | | dto.setCustomerId(currentCustomer.getId()); |
| | | |
| | | CreateCouponRecordDTO dtoTrans=new CreateCouponRecordDTO(); |
| | | BeanUtils.copyProperties(dto,dtoTrans); |
| | | |
| | | couponRecordService.createCouponRecord(dtoTrans); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponTemplateDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponDTO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateActivyVO; |
| | | import com.mzl.flower.enums.CouponUsageTypeEnum; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/coupon/all") |
| | | //@Api(value = "优惠券管理-活动", tags = "优惠券管理-活动") |
| | | @Validated |
| | | public class CouponTemplateController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponTemplateService2 couponTemplateService; |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增优惠券", notes = "新增优惠券") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponTemplateDTO dto) { |
| | | |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | // couponTemplateService.createCouponTemplate(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@PathVariable String id,@Validated @RequestBody CreateCouponTemplateDTO dto) { |
| | | |
| | | // 手动设置id值 |
| | | dto.setId(id); |
| | | CouponTemplateDO couponTemplateDO= couponTemplateService.getById(dto.getId()); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | // couponTemplateService.updateCouponTemplate(dto); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id ) { |
| | | |
| | | CouponTemplateDO couponTemplateDO= couponTemplateService.getById(id); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | couponTemplateService.deleteCouponTemplate(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | // CouponTemplateActivyVO couponTemplateActivyVO=couponTemplateService.getActivityCouponDetailById(id); |
| | | return returnData(R.SUCCESS.getCode(),null); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateActivyVO>>> page( |
| | | Page page, QueryCouponDTO dto |
| | | ) { |
| | | // couponTemplateService.getActivityPage(page,dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateActivyVO>>> list(QueryCouponDTO dto |
| | | ) { |
| | | // couponTemplateService.getActivityList(dto) |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | @PutMapping("/active/{id}") |
| | | @ApiOperation(value = "发布", notes = "发布") |
| | | public ResponseEntity<ReturnDataDTO> active(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO= couponTemplateService.getById(id); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.activeCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/expire/{id}") |
| | | @ApiOperation(value = "下架", notes = "下架") |
| | | public ResponseEntity<ReturnDataDTO> expire(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO= couponTemplateService.getById(id); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.expireCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | private void valid(CreateCouponTemplateDTO dto){ |
| | | // 领取后 固定时间 |
| | | if(StringUtils.isNotBlank(dto.getUsageType()) && dto.getUsageType().equals(CouponUsageTypeEnum.FIXED.getType()) ){ |
| | | // 如果使用时间是固定时间的话,那么固定时间的开始时间和结束时间就不能为空 |
| | | if(dto.getUsageStartDate()==null){ |
| | | throw new ValidationException("固定时间开始日期不能为空"); |
| | | } |
| | | if(dto.getUsageEndDate()==null){ |
| | | throw new ValidationException("固定时间结束日期不能为空"); |
| | | } |
| | | } |
| | | |
| | | // 领取后 有效时间 |
| | | if(StringUtils.isNotBlank(dto.getUsageType()) && dto.getUsageType().equals(CouponUsageTypeEnum.GET_AFTER_TIME.getType())){ |
| | | // 如果使用时间是领取后有效时间的话,那么领取后的时间类型不能为空,且时间不能为空 |
| | | if(StringUtils.isBlank(dto.getUsageTimeType())){ |
| | | throw new ValidationException("领取后有效时间类型不能为空"); |
| | | } |
| | | |
| | | if(dto.getUsageTimeNum()==null){ |
| | | throw new ValidationException("领取后有效时间整数不能为空"); |
| | | } |
| | | if(dto.getUsageTimeNum()<=0){ |
| | | throw new ValidationException("领取后有效时间整数需要大于0"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponPointStatisVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplatePointVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.enums.CouponCategoryEnum; |
| | | import com.mzl.flower.enums.CouponStatusEnum; |
| | | import com.mzl.flower.enums.CouponTypeEnum; |
| | | import com.mzl.flower.enums.CouponUsageTypeEnum; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/coupon/point") |
| | | @Api(value = "优惠券管理-积分", tags = "优惠券管理-积分") |
| | | @Validated |
| | | public class CouponTemplatePointController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponTemplateService2 couponTemplateService; |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponTemplatePointDTO dto) { |
| | | |
| | | // 信息校验 |
| | | valid(dto); |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成积分优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | // 设置默认类型领取后有效 |
| | | couponTemplateBO.setUsageType(CouponUsageTypeEnum.GET_AFTER_TIME.getType()); |
| | | |
| | | couponTemplateService.createCouponTemplate(couponTemplateBO); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | |
| | | |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@PathVariable String id,@Validated @RequestBody CreateCouponTemplatePointDTO dto) { |
| | | // 信息校验 |
| | | dto.setId(id); |
| | | valid(dto); |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getId()); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(couponTemplateDO,couponTemplateBO); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成积分优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | // 设置默认类型 |
| | | couponTemplateBO.setUsageType(CouponUsageTypeEnum.GET_AFTER_TIME.getType()); |
| | | |
| | | |
| | | couponTemplateService.updateCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | couponTemplateService.deleteCouponTemplate(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | CouponTemplateVO couponTemplateVO = couponTemplateService.getDetailById(id); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(couponTemplateVO, CouponTemplatePointVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplatePointVO>>> page(Page page, QueryCouponDTO dto) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | Page<CouponTemplateVO> resultPage = couponTemplateService.getPage(page, dto); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplatePointVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> list(QueryCouponDTO dto) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getList(dto), CouponTemplatePointVO.class)); |
| | | } |
| | | |
| | | |
| | | @PutMapping("/active/{id}") |
| | | @ApiOperation(value = "发布", notes = "发布") |
| | | public ResponseEntity<ReturnDataDTO> active(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.activeCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/expire/{id}") |
| | | @ApiOperation(value = "下架", notes = "下架") |
| | | public ResponseEntity<ReturnDataDTO> expire(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.expireCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PostMapping("/batch/expire") |
| | | @ApiOperation(value = "批量下架", notes = "批量下架") |
| | | public ResponseEntity<ReturnDataDTO> expireBatch(@RequestBody BatchCouponTemplateDTO dto) { |
| | | |
| | | |
| | | couponTemplateService.expireBatchCouponTemplate(dto); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/batch/active") |
| | | @ApiOperation(value = "批量发布", notes = "批量发布") |
| | | public ResponseEntity<ReturnDataDTO> activeBatch(@RequestBody BatchCouponTemplateDTO dto) { |
| | | |
| | | couponTemplateService.activeBatchCouponTemplate(dto); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/batch/del") |
| | | @ApiOperation(value = "批量删除", notes = "批量删除") |
| | | public ResponseEntity<ReturnDataDTO> deleteBatch(@RequestBody BatchCouponTemplateDTO dto) { |
| | | |
| | | couponTemplateService.deleteBatchCouponTemplate(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/statistics") |
| | | @ApiOperation(value = "积分统计", notes = "积分统计") |
| | | public ResponseEntity<ReturnDataDTO> statistics(QueryCouponStatisticsDTO dto) { |
| | | QueryCouponStatisticsBO queryCouponStatisticsBO=new QueryCouponStatisticsBO(); |
| | | BeanUtils.copyProperties(dto,queryCouponStatisticsBO); |
| | | CouponPointStatisVO vo = couponTemplateService.statisCouponTemplatePoint(queryCouponStatisticsBO); |
| | | return returnData(R.SUCCESS.getCode(), vo); |
| | | } |
| | | |
| | | @GetMapping("/active/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> activeList(QueryActivePointCouponDTO dto) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | dto.setStatus(CouponStatusEnum.ACTIVE.getStatus()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getPointList(dto), CouponTemplatePointVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/active/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplatePointVO>>> activePage(Page page, QueryActivePointCouponDTO dto) { |
| | | // 设置只查询积分优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.POINT.getStatus()); |
| | | dto.setStatus(CouponStatusEnum.ACTIVE.getStatus()); |
| | | Page<CouponTemplateVO> resultPage = couponTemplateService.getPointPage(page, dto); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplatePointVO.class)); |
| | | } |
| | | |
| | | |
| | | private void valid(CreateCouponTemplatePointDTO dto){ |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getCouponDiscountValue().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ValidationException("折扣金额必须大于0"); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) |
| | | && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/exchange") |
| | | @ApiOperation(value = "小程序-积分优惠券兑换", notes = "小程序-积分优惠券兑换") |
| | | public ResponseEntity<ReturnDataDTO> exchangeCoupon(@Validated @RequestBody ExchangeCouponDTO dto) { |
| | | couponTemplateService.exchangeCoupon(dto); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | |
| | | |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponTemplateBO; |
| | | import com.mzl.flower.dto.request.coupon.CreateCouponTemplateUserDTO; |
| | | import com.mzl.flower.dto.request.coupon.QueryCouponDTO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplatePointVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateUserVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.enums.*; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/coupon/user") |
| | | @Api(value = "优惠券管理-用户", tags = "优惠券管理-用户") |
| | | @Validated |
| | | public class CouponTemplateUserController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponTemplateService2 couponTemplateService; |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponTemplateUserDTO dto) { |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成指定用户 |
| | | couponTemplateBO.setGetUserType(CouponGetUserTypeEnum.TARGET.getType()); |
| | | // 设置成用户优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.USER.getStatus()); |
| | | // 设置默认类型 |
| | | couponTemplateBO.setUsageType(CouponUsageTypeEnum.GET_AFTER_TIME.getType()); |
| | | |
| | | couponTemplateService.createCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | |
| | | |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@PathVariable String id,@Validated @RequestBody CreateCouponTemplateUserDTO dto) { |
| | | |
| | | dto.setId(id); |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | |
| | | if (dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getId()); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(couponTemplateDO,couponTemplateBO); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成指定用户 |
| | | couponTemplateBO.setGetUserType(CouponGetUserTypeEnum.TARGET.getType()); |
| | | // 设置成用户优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.USER.getStatus()); |
| | | // 设置默认类型 |
| | | couponTemplateBO.setUsageType(CouponUsageTypeEnum.GET_AFTER_TIME.getType()); |
| | | |
| | | |
| | | couponTemplateService.updateCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | couponTemplateService.deleteCouponTemplate(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | CouponTemplateVO couponTemplateVO = couponTemplateService.getDetailById(id); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(couponTemplateVO, CouponTemplateUserVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplatePointVO>>> page( |
| | | Page page, QueryCouponDTO dto |
| | | ) { |
| | | // 设置只查询用户优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.USER.getStatus()); |
| | | Page<CouponTemplateVO> resultPage = couponTemplateService.getPage(page, dto); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplateUserVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVO>>> list(QueryCouponDTO dto |
| | | ) { |
| | | // 设置只查询用户优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.USER.getStatus()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getList(dto), CouponTemplateUserVO.class)); |
| | | } |
| | | |
| | | |
| | | @PutMapping("/active/{id}") |
| | | @ApiOperation(value = "发布", notes = "发布") |
| | | public ResponseEntity<ReturnDataDTO> active(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) |
| | | && couponTemplateDO.getStatus().equals(CouponStatusEnum.ACTIVE.getStatus())){ |
| | | throw new ValidationException("已发布的的商品不可重复发布"); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(couponTemplateDO.getStatus()) |
| | | && couponTemplateDO.getStatus().equals(CouponStatusEnum.EXPIRED.getStatus())){ |
| | | throw new ValidationException("已下架的商品不可重复上架"); |
| | | } |
| | | |
| | | couponTemplateService.activeCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/expire/{id}") |
| | | @ApiOperation(value = "下架", notes = "下架") |
| | | public ResponseEntity<ReturnDataDTO> expire(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.expireCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.mzl.flower.web.v2.coupon; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.mzl.flower.base.BaseController; |
| | | import com.mzl.flower.base.R; |
| | | import com.mzl.flower.base.ReturnDataDTO; |
| | | import com.mzl.flower.config.exception.ValidationException; |
| | | import com.mzl.flower.dto.request.coupon.*; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVO; |
| | | import com.mzl.flower.dto.response.coupon.CouponTemplateVipVO; |
| | | import com.mzl.flower.entity.coupon.CouponTemplateDO; |
| | | import com.mzl.flower.entity.menber.Member; |
| | | import com.mzl.flower.enums.CouponCategoryEnum; |
| | | import com.mzl.flower.enums.CouponTypeEnum; |
| | | import com.mzl.flower.service.coupon.CouponTemplateService2; |
| | | import com.mzl.flower.service.menber.MemberService; |
| | | import com.mzl.flower.utils.ConverterUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author @TaoJie |
| | | * @since 2024-08-22 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/api/v2/coupon/vip") |
| | | @Api(value = "优惠券管理-会员", tags = "优惠券管理-会员") |
| | | @Validated |
| | | public class CouponTemplateVipController extends BaseController { |
| | | |
| | | @Autowired |
| | | CouponTemplateService2 couponTemplateService; |
| | | |
| | | @Autowired |
| | | MemberService memberService; |
| | | |
| | | @PostMapping("") |
| | | @ApiOperation(value = "新增", notes = "新增") |
| | | public ResponseEntity<ReturnDataDTO> create(@Validated @RequestBody CreateCouponTemplateVipDTO dto) { |
| | | |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成会员优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.MEMBER.getStatus()); |
| | | |
| | | couponTemplateService.createCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/{id}") |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | public ResponseEntity<ReturnDataDTO> update(@PathVariable String id,@Validated @RequestBody CreateCouponTemplateVipDTO dto) { |
| | | |
| | | dto.setId(id); |
| | | // 信息验证 |
| | | valid(dto); |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(dto.getId()); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | CreateCouponTemplateBO couponTemplateBO = new CreateCouponTemplateBO(); |
| | | BeanUtils.copyProperties(couponTemplateDO,couponTemplateBO); |
| | | BeanUtils.copyProperties(dto, couponTemplateBO); |
| | | |
| | | // 设置成会员优惠券 |
| | | couponTemplateBO.setCategory(CouponCategoryEnum.MEMBER.getStatus()); |
| | | |
| | | couponTemplateService.updateCouponTemplate(couponTemplateBO); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "删除", notes = "删除") |
| | | public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id ) { |
| | | |
| | | CouponTemplateDO couponTemplateDO= couponTemplateService.getById(id); |
| | | if(null==couponTemplateDO){ |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | couponTemplateService.deleteCouponTemplate(id); |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | public ResponseEntity<ReturnDataDTO> get(@PathVariable String id) { |
| | | CouponTemplateVO couponTemplateVO = couponTemplateService.getDetailById(id); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transObject(couponTemplateVO, CouponTemplateVipVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "查询-分页", notes = "查询-分页") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVipVO>>> page( |
| | | Page page, QueryCouponDTO dto |
| | | ) { |
| | | // 设置只查询会员优惠券的 |
| | | dto.setCategory(CouponCategoryEnum.MEMBER.getStatus()); |
| | | Page<CouponTemplateVO> resultPage = couponTemplateService.getPage(page, dto); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transPage(resultPage, CouponTemplateVipVO.class)); |
| | | |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询-全部", notes = "查询-全部") |
| | | public ResponseEntity<ReturnDataDTO<Page<CouponTemplateVipVO>>> list(QueryCouponDTO dto |
| | | ) { |
| | | dto.setCategory(CouponCategoryEnum.MEMBER.getStatus()); |
| | | return returnData(R.SUCCESS.getCode(), ConverterUtil.transList(couponTemplateService.getList(dto), CouponTemplateVipVO.class)); |
| | | } |
| | | |
| | | @PutMapping("/active/{id}") |
| | | @ApiOperation(value = "发布", notes = "发布") |
| | | public ResponseEntity<ReturnDataDTO> active(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.activeCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | @PutMapping("/expire/{id}") |
| | | @ApiOperation(value = "下架", notes = "下架") |
| | | public ResponseEntity<ReturnDataDTO> expire(@PathVariable String id) { |
| | | |
| | | CouponTemplateDO couponTemplateDO = couponTemplateService.getById(id); |
| | | if (null == couponTemplateDO) { |
| | | throw new ValidationException("优惠券不存在"); |
| | | } |
| | | |
| | | couponTemplateService.expireCouponTemplate(id); |
| | | |
| | | return returnData(R.SUCCESS.getCode(), null); |
| | | } |
| | | |
| | | |
| | | private void valid(CreateCouponTemplateVipDTO dto){ |
| | | |
| | | final Member member = memberService.getById(dto.getMemberId()); |
| | | |
| | | if(null==member){ |
| | | throw new ValidationException("会员等级不存在"); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getMinOrderAmount().compareTo(dto.getCouponDiscountValue()) < 0) { |
| | | throw new ValidationException("订单金额不能小于折扣金额"); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.DISCOUNT.getType()) |
| | | && dto.getCouponDiscountValue().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new ValidationException("折扣金额必须大于0"); |
| | | } |
| | | |
| | | if (StringUtils.isNotBlank(dto.getCouponDiscountType()) |
| | | && dto.getCouponDiscountType().equals(CouponTypeEnum.ZERO.getType()) |
| | | && dto.getMinOrderAmount().compareTo(BigDecimal.ZERO) != 0) { |
| | | throw new ValidationException("无门槛的订单金额必须为0"); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | maxRequestSize: 50MB |
| | | |
| | | mybatis-plus: |
| | | mapper-locations: classpath:/mapper/*Mapper.xml,classpath:/mapper/**/*Mapper.xml |
| | | mapper-locations: classpath:/mapper/*Mapper.xml,classpath:/mapper/**/*Mapper.xml,classpath:/mapper/*Mapper*.xml,classpath:/mapper/**/*Mapper*.xml |
| | | global-config: |
| | | banner: false |
| | | db-config: |
| | |
| | | |
| | | wx: |
| | | miniapp: |
| | | appid: wx3203fd935a6ffe09 #小程序appId 花店端 |
| | | secret: 9121c703fb0c416b21a8c289dd73ae9b #secret花店端 |
| | | appid: wx1441324401626290 #小程序appId 花店端 |
| | | secret: bab595ac75f60eb33567511111a569a7 #secret花店端 |
| | | msgDataFormat: JSON |
| | | mp: |
| | | app-id: xxx #公众号appId |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mzl.flower.mapper.coupon.CouponRecordMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.coupon.CouponRecordDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="deleted" property="deleted" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="coupon_id" property="couponId" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="customer_id" property="customerId" /> |
| | | <result column="status" property="status" /> |
| | | <result column="effective_start" property="effectiveStart" /> |
| | | <result column="effective_end" property="effectiveEnd" /> |
| | | <result column="order_id" property="orderId" /> |
| | | <result column="used_time" property="usedTime" /> |
| | | <result column="coupon_discount_value" property="couponDiscountValue" /> |
| | | <result column="min_order_amount" property="minOrderAmount" /> |
| | | <result column="category" property="category" /> |
| | | <result column="coupon_code" property="couponCode" /> |
| | | <result column="coupon_name" property="couponName" /> |
| | | |
| | | <result column="point" property="point" /> |
| | | <result column="image_url" property="imageUrl" /> |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mzl.flower.mapper.coupon.CouponRecordMapperCustom"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.coupon.CouponRecordDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="deleted" property="deleted" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="coupon_id" property="couponId" /> |
| | | <result column="user_id" property="userId" /> |
| | | <result column="customer_id" property="customerId" /> |
| | | <result column="status" property="status" /> |
| | | <result column="effective_start" property="effectiveStart" /> |
| | | <result column="effective_end" property="effectiveEnd" /> |
| | | <result column="order_id" property="orderId" /> |
| | | <result column="used_time" property="usedTime" /> |
| | | <result column="coupon_discount_value" property="couponDiscountValue" /> |
| | | <result column="min_order_amount" property="minOrderAmount" /> |
| | | <result column="category" property="category" /> |
| | | <result column="coupon_code" property="couponCode" /> |
| | | <result column="coupon_name" property="couponName" /> |
| | | <result column="get_type" property="getType" /> |
| | | <result column="coupon_discount_type" property="couponDiscountType" /> |
| | | <result column="get_user_type" property="getUserType" /> |
| | | |
| | | <result column="point" property="point" /> |
| | | |
| | | </resultMap> |
| | | <update id="checkCouponExpired"> |
| | | update t_coupon_record set `status`='expired' where `status`='unused' and effective_end < NOW() |
| | | <if test="param.userId != null and param.userId != ''"> |
| | | AND user_id = #{param.userId} |
| | | </if> |
| | | <if test="param.customerId != null and param.customerId != ''"> |
| | | AND customer_id = #{param.customerId} |
| | | </if> |
| | | </update> |
| | | |
| | | <select id="statisCouponTemplateCount" resultType="java.lang.Integer"> |
| | | select IFNULL(count(1),0) as cnt from t_coupon_record where deleted=false and category=#{param.category} |
| | | </select> |
| | | <select id="statisCouponTemplateCurMonCount" resultType="java.lang.Integer"> |
| | | select IFNULL(count(1),0) as cnt from t_coupon_record where deleted=false and category=#{param.category} AND DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m') |
| | | </select> |
| | | <select id="statisCouponPointCurMonPointAmonut" resultType="java.lang.Integer"> |
| | | select IFNULL(sum(point),0) as cnt from t_coupon_record where deleted=false and category='point' AND DATE_FORMAT(create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m') |
| | | </select> |
| | | |
| | | <select id="getPage" resultType="com.mzl.flower.dto.response.coupon.CouponRecordVO"> |
| | | <include refid="QuerySql"/> |
| | | </select> |
| | | <select id="getList" resultType="com.mzl.flower.dto.response.coupon.CouponRecordVO"> |
| | | <include refid="QuerySql"/> |
| | | </select> |
| | | <select id="getMineCouponRecordList" resultType="com.mzl.flower.dto.response.coupon.CouponRecordVO"> |
| | | select * |
| | | from t_coupon_record t |
| | | where t.deleted=false |
| | | <if test="param.userId != null and param.userId != ''"> |
| | | AND t.user_id = #{param.userId} |
| | | </if> |
| | | <if test="param.customerId != null and param.customerId != ''"> |
| | | AND t.customer_id = #{param.customerId} |
| | | </if> |
| | | <if test="param.status != null and param.status != ''"> |
| | | AND t.status = #{param.status} |
| | | </if> |
| | | </select> |
| | | |
| | | <sql id="QuerySql"> |
| | | select * |
| | | from ( |
| | | select r.*, |
| | | i.name as customerName, |
| | | u.tel, |
| | | o.order_no |
| | | from t_coupon_record r |
| | | left join t_customer_info i |
| | | on r.customer_id=i.id |
| | | left join t_user u |
| | | on i.user_id=u.id |
| | | left join t_order o |
| | | on r.order_id=o.id |
| | | ) t |
| | | where t.deleted=0 |
| | | <if test="param.name != null and param.name != ''"> |
| | | AND t.coupon_name like concat('%', #{param.name},'%') |
| | | </if> |
| | | <if test="param.couponDiscountType != null and param.couponDiscountType != ''"> |
| | | AND t.coupon_discount_type = #{param.couponDiscountType} |
| | | </if> |
| | | <if test="param.getType != null and param.getType != ''"> |
| | | AND t.get_type = #{param.getType} |
| | | </if> |
| | | <if test="param.getUserType != null and param.getUserType != ''"> |
| | | AND t.get_user_type = #{param.getUserType} |
| | | </if> |
| | | <if test="param.id != null and param.id != ''"> |
| | | AND t.id = #{param.id} |
| | | </if> |
| | | <if test="param.orderNo != null and param.orderNo != ''"> |
| | | AND t.order_no like concat('%', #{param.orderNo},'%') |
| | | </if> |
| | | <if test="param.tel != null and param.tel != ''"> |
| | | AND t.tel like concat('%', #{param.tel},'%') |
| | | </if> |
| | | <if test="param.status != null and param.status != ''"> |
| | | AND t.status = #{param.status} |
| | | </if> |
| | | <if test="param.keyword != null and param.keyword != ''"> |
| | | AND (t.customerName like concat('%', #{param.keyword},'%') |
| | | or t.user_id like concat('%', #{param.keyword},'%') ) |
| | | </if> |
| | | <if test="param.couponId != null and param.couponId != ''"> |
| | | and t.coupon_id = #{param.couponId} |
| | | </if> |
| | | <if test="param.category != null and param.category != ''"> |
| | | and t.category = #{param.category} |
| | | </if> |
| | | |
| | | |
| | | |
| | | order by t.create_time desc |
| | | </sql> |
| | | |
| | | |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mzl.flower.mapper.coupon.CouponTemplateCustomerMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.coupon.CouponTemplateCustomerDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="coupon_id" property="couponId" /> |
| | | <result column="custom_id" property="customId" /> |
| | | </resultMap> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mzl.flower.mapper.coupon.CouponTemplateMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.coupon.CouponTemplateDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="deleted" property="deleted" /> |
| | | <result column="coupon_code" property="couponCode" /> |
| | | <result column="coupon_name" property="couponName" /> |
| | | <result column="coupon_description" property="couponDescription" /> |
| | | <result column="coupon_amount" property="couponAmount" /> |
| | | <result column="coupon_discount_type" property="couponDiscountType" /> |
| | | <result column="coupon_discount_value" property="couponDiscountValue" /> |
| | | <result column="min_order_amount" property="minOrderAmount" /> |
| | | <result column="max_discount_amount" property="maxDiscountAmount" /> |
| | | <result column="get_type" property="getType" /> |
| | | <result column="get_user_type" property="getUserType" /> |
| | | <result column="get_start_date" property="getStartDate" /> |
| | | <result column="get_end_date" property="getEndDate" /> |
| | | <result column="get_limit" property="getLimit" /> |
| | | <result column="usage_type" property="usageType" /> |
| | | <result column="usage_limit" property="usageLimit" /> |
| | | <result column="usage_per_user" property="usagePerUser" /> |
| | | <result column="usage_start_date" property="usageStartDate" /> |
| | | <result column="usage_end_date" property="usageEndDate" /> |
| | | <result column="usage_time_type" property="usageTimeType" /> |
| | | <result column="usage_time_num" property="usageTimeNum" /> |
| | | <result column="status" property="status" /> |
| | | |
| | | <result column="member_id" property="memberId" /> |
| | | <result column="image_url" property="imageUrl" /> |
| | | |
| | | |
| | | </resultMap> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.mzl.flower.mapper.coupon.CouponTemplateMapperCustom"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.mzl.flower.entity.coupon.CouponTemplateDO"> |
| | | <id column="id" property="id" /> |
| | | <result column="create_by" property="createBy" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_by" property="updateBy" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="deleted" property="deleted" /> |
| | | <result column="category" property="category" /> |
| | | <result column="coupon_code" property="couponCode" /> |
| | | <result column="coupon_name" property="couponName" /> |
| | | <result column="coupon_description" property="couponDescription" /> |
| | | <result column="coupon_amount" property="couponAmount" /> |
| | | <result column="coupon_discount_type" property="couponDiscountType" /> |
| | | <result column="coupon_discount_value" property="couponDiscountValue" /> |
| | | <result column="min_order_amount" property="minOrderAmount" /> |
| | | <result column="max_discount_amount" property="maxDiscountAmount" /> |
| | | <result column="get_type" property="getType" /> |
| | | <result column="get_user_type" property="getUserType" /> |
| | | <result column="get_start_date" property="getStartDate" /> |
| | | <result column="get_end_date" property="getEndDate" /> |
| | | <result column="get_limit" property="getLimit" /> |
| | | <result column="usage_type" property="usageType" /> |
| | | <result column="usage_limit" property="usageLimit" /> |
| | | <result column="usage_per_user" property="usagePerUser" /> |
| | | <result column="usage_start_date" property="usageStartDate" /> |
| | | <result column="usage_end_date" property="usageEndDate" /> |
| | | <result column="usage_time_type" property="usageTimeType" /> |
| | | <result column="usage_time_num" property="usageTimeNum" /> |
| | | <result column="status" property="status" /> |
| | | <result column="point" property="point" /> |
| | | <result column="member_id" property="memberId" /> |
| | | </resultMap> |
| | | |
| | | |
| | | <update id="activeBatchCouponTemplate"> |
| | | update t_coupon_template set status='active',update_by=#{param.updateBy},update_time=now() where id in |
| | | <foreach collection="param.idList" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </update> |
| | | <update id="expireBatchCouponTemplate"> |
| | | update t_coupon_template set status='expired',update_by=#{param.updateBy},update_time=now() where id in |
| | | <foreach collection="param.idList" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </update> |
| | | |
| | | <update id="deleteBatchCouponTemplate"> |
| | | update t_coupon_template set deleted=true ,update_by=#{param.updateBy},update_time=now() where id in |
| | | <foreach collection="param.idList" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </update> |
| | | <update id="expireHomeActivityCouponTemplate"> |
| | | update t_coupon_template set status='expired' where category='activity' and get_type='home' and status='active' |
| | | </update> |
| | | |
| | | <select id="getCouponTemplatePage" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> |
| | | <include refid="QuerySql2"/> |
| | | </select> |
| | | <select id="getList" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> |
| | | <include refid="QuerySql2"/> |
| | | </select> |
| | | <select id="getCouponPointList" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> |
| | | <include refid="QueryPointSql" /> |
| | | </select> |
| | | <select id="getPointPage" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> |
| | | <include refid="QueryPointSql" /> |
| | | </select> |
| | | |
| | | <!-- app活动优惠券--> |
| | | <select id="getActivityEffectList" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> |
| | | |
| | | SELECT * |
| | | FROM t_coupon_template t |
| | | WHERE t.deleted = FALSE |
| | | <if test="param.category != null and param.category != '' and param.category == 'activity' "> |
| | | AND t.get_start_date <= NOW() |
| | | AND NOW() <= t.get_end_date |
| | | </if> |
| | | |
| | | <if test="param.category != null and param.category != ''"> |
| | | AND category = #{param.category} |
| | | </if> |
| | | <if test="param.status != null and param.status != ''"> |
| | | AND status = #{param.status} |
| | | </if> |
| | | <if test="param.getType != null and param.getType != ''"> |
| | | AND t.get_type = #{param.getType} |
| | | </if> |
| | | ORDER BY t.create_time DESC |
| | | |
| | | </select> |
| | | <select id="getCouponCustomerList" |
| | | resultType="com.mzl.flower.dto.response.coupon.CouponTemplateCustomerVO"> |
| | | select ci.id,ci.name,u.tel |
| | | from t_coupon_template c |
| | | left JOIN t_coupon_template_customer cc |
| | | on c.id=cc.coupon_id |
| | | left join t_customer_info ci |
| | | on cc.custom_id=ci.id |
| | | left join t_user u |
| | | on ci.user_id=u.id |
| | | where c.deleted= false |
| | | and c.id=#{id} |
| | | |
| | | </select> |
| | | <select id="getVipList" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> |
| | | <include refid="QuerySqlVip" /> |
| | | </select> |
| | | <select id="getCouponTemplateVipPage" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> |
| | | <include refid="QuerySqlVip" /> |
| | | </select> |
| | | <select id="getHomeActivityEffectAlert" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> |
| | | SELECT * |
| | | FROM t_coupon_template t |
| | | WHERE t.deleted = FALSE |
| | | |
| | | <if test="param.category != null and param.category != '' and param.category == 'activity' "> |
| | | AND t.get_start_date <= NOW() |
| | | AND NOW() <= t.get_end_date |
| | | </if> |
| | | |
| | | <if test="param.category != null and param.category != ''"> |
| | | AND t.category = #{param.category} |
| | | </if> |
| | | <if test="param.status != null and param.status != ''"> |
| | | AND t.status = #{param.status} |
| | | </if> |
| | | <if test="param.getType != null and param.getType != ''"> |
| | | AND t.get_type = #{param.getType} |
| | | </if> |
| | | ORDER BY t.create_time DESC |
| | | limit 1 |
| | | </select> |
| | | |
| | | <sql id="QueryPointSql"> |
| | | select * |
| | | from t_coupon_template |
| | | where deleted=0 |
| | | <if test="param.category != null and param.category != ''"> |
| | | AND category = #{param.category} |
| | | </if> |
| | | <if test="param.status != null and param.status != ''"> |
| | | AND status = #{param.status} |
| | | </if> |
| | | <if test="param.minPoint != null "> |
| | | AND point >= #{param.minPoint} |
| | | </if> |
| | | <if test="param.maxPoint != null "> |
| | | AND point <= #{param.maxPoint} |
| | | </if> |
| | | <if test="param.orderStr != null and param.orderStr != '' "> |
| | | order by ${param.orderStr} |
| | | </if> |
| | | |
| | | </sql> |
| | | |
| | | <sql id="QuerySql2"> |
| | | select * |
| | | from ( |
| | | select t.*, |
| | | create_by_user.nick_name as createByName, |
| | | IFNULL(get_num.cnt, 0) as getNum, |
| | | IFNULL(t.coupon_amount, 0) - IFNULL(get_num.cnt, 0) as unGetNum |
| | | from t_coupon_template t |
| | | left join t_user create_by_user |
| | | on t.create_by =create_by_user.id |
| | | left join (select coupon_id,count(1) as cnt from t_coupon_record where deleted=0 group by coupon_id) get_num |
| | | on t.id=get_num.coupon_id |
| | | ) t |
| | | where t.deleted=0 |
| | | <if test="param.name != null and param.name != ''"> |
| | | AND t.coupon_name like concat('%', #{param.name},'%') |
| | | </if> |
| | | <if test="param.couponDiscountType != null and param.couponDiscountType != ''"> |
| | | AND t.coupon_discount_type = #{param.couponDiscountType} |
| | | </if> |
| | | <if test="param.getType != null and param.getType != ''"> |
| | | AND t.get_type = #{param.getType} |
| | | </if> |
| | | <if test="param.getUserType != null and param.getUserType != ''"> |
| | | AND t.get_user_type = #{param.getUserType} |
| | | </if> |
| | | <if test="param.id != null and param.id != ''"> |
| | | AND t.id = #{param.id} |
| | | </if> |
| | | <if test="param.category != null and param.category != ''"> |
| | | AND t.category = #{param.category} |
| | | </if> |
| | | <if test="param.status != null and param.status != ''"> |
| | | AND t.status = #{param.status} |
| | | </if> |
| | | order by t.create_time desc |
| | | </sql> |
| | | |
| | | <sql id="QuerySqlVip"> |
| | | select * |
| | | from ( |
| | | select t.*, |
| | | create_by_user.nick_name as createByName, |
| | | IFNULL(get_num.cnt, 0) as getNum, |
| | | IFNULL(t.coupon_amount, 0) - IFNULL(get_num.cnt, 0) as unGetNum, |
| | | m.`name` as member_name |
| | | from t_coupon_template t |
| | | left join t_user create_by_user |
| | | on t.create_by =create_by_user.id |
| | | left join (select coupon_id,count(1) as cnt from t_coupon_record where deleted=0 group by coupon_id) get_num |
| | | on t.id=get_num.coupon_id |
| | | left join t_member m |
| | | on t.member_id=m.id |
| | | ) t |
| | | where t.deleted=0 |
| | | <if test="param.name != null and param.name != ''"> |
| | | AND t.coupon_name like concat('%', #{param.name},'%') |
| | | </if> |
| | | <if test="param.couponDiscountType != null and param.couponDiscountType != ''"> |
| | | AND t.coupon_discount_type = #{param.couponDiscountType} |
| | | </if> |
| | | <if test="param.getType != null and param.getType != ''"> |
| | | AND t.get_type = #{param.getType} |
| | | </if> |
| | | <if test="param.getUserType != null and param.getUserType != ''"> |
| | | AND t.get_user_type = #{param.getUserType} |
| | | </if> |
| | | <if test="param.id != null and param.id != ''"> |
| | | AND t.id = #{param.id} |
| | | </if> |
| | | <if test="param.category != null and param.category != ''"> |
| | | AND t.category = #{param.category} |
| | | </if> |
| | | <if test="param.status != null and param.status != ''"> |
| | | AND t.status = #{param.status} |
| | | </if> |
| | | order by t.create_time desc |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | </if> |
| | | ORDER BY f.create_time DESC |
| | | </select> |
| | | |
| | | <select id="getStatisFansCount" resultType="java.lang.Integer"> |
| | | SELECT IFNULL(COUNT(DISTINCT f.user_id), 0) |
| | | FROM t_follow_supplier f |
| | | WHERE f.deleted = 0 |
| | | AND f.supplier_id = #{supplierId}; |
| | | </select> |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.mzl.flower.mapper.member.MemberGrowthRecordMapper"> |
| | | |
| | | <select id="queryPage" resultType="com.mzl.flower.dto.response.member.MemberGrowthRecordVO"> |
| | | select * from t_member_growth_record t where t.deleted= 0 |
| | | <if test="dto.type != null and dto.type != ''"> |
| | | and t.type = #{dto.type} |
| | | </if> |
| | | <if test="dto.source != null and dto.source != ''"> |
| | | and t.source = #{dto.source} |
| | | </if> |
| | | <if test="dto.startRecordDate!=null "> |
| | | <![CDATA[ |
| | | AND t.create_time >= #{dto.startRecordDate} |
| | | ]]> |
| | | </if> |
| | | <if test="dto.endRecordDate!=null "> |
| | | <![CDATA[ |
| | | AND t.create_time <= #{dto.endRecordDate} |
| | | ]]> |
| | | </if> |
| | | <if test="dto.userId != null and dto.userId != ''"> |
| | | and t.user_id = #{dto.userId} |
| | | </if> |
| | | order by t.update_time desc |
| | | </select> |
| | | |
| | | <select id="queryUserPage" resultType="com.mzl.flower.dto.response.member.UserGrowthRecordVO"> |
| | | SELECT c.name as nickName, c.level_id as levelId, t.tel, t.id as userId, m.name AS levelName, IFNULL(SUM(mg.growth), 0) AS sumGrowthValue |
| | | FROM t_customer_info c |
| | | LEFT JOIN t_user t ON c.user_id = t.id |
| | | LEFT JOIN t_member m ON c.level_id = m.id |
| | | LEFT JOIN (SELECT user_id, SUM(growth) AS growth |
| | | FROM t_member_growth_record |
| | | WHERE deleted = 0 |
| | | GROUP BY user_id) mg ON c.user_id = mg.user_id |
| | | WHERE c.deleted = 0 |
| | | <if test="dto.nickName!= null and dto.nickName != ''"> |
| | | AND c.name LIKE CONCAT('%',#{dto.nickName},'%') |
| | | </if> |
| | | <if test="dto.tel!= null and dto.tel != ''"> |
| | | and t.tel like CONCAT('%',#{dto.tel},'%') |
| | | </if> |
| | | GROUP BY c.id |
| | | order by c.update_time desc |
| | | </select> |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.mzl.flower.mapper.member.MemberMapper"> |
| | | |
| | | <select id="queryPage" resultType="com.mzl.flower.dto.response.member.MemberVO"> |
| | | select t.*, u.nick_name createName from t_member t |
| | | left join t_user u on t.create_by = u.id |
| | | where t.deleted= 0 |
| | | <if test="dto.name != null and dto.name != ''"> |
| | | and t.name like concat('%', #{dto.name}, '%') |
| | | </if> |
| | | order by t.start_point |
| | | </select> |
| | | </mapper> |
| | |
| | | <select id="selectSettlementListByTime" resultType="com.mzl.flower.dto.response.payment.DeliveryOrderItemSettlementDTO"> |
| | | SELECT ois.order_item_id, oi.flower_name, oi.flower_level, oi.num, oi.supplier_price price , s.`status` |
| | | , ois.check_num, ois.check_fee, ois.replace_num, ois.replace_fee, ois.lack_num, ois.lack_fee_supplier lackFee |
| | | , ois.station_fee, ois.sales_fee_supplier salesFee, ois.service_fee_rate, ois.service_fee, ois.income_supplier |
| | | , o.status_backend, o.create_time orderTime |
| | | , ois.station_fee, ois.sales_fee_supplier salesFee, ois.service_fee_rate, ois.service_fee |
| | | , ois.income_supplier income, o.status_backend, o.create_time orderTime, o.receive_time, o.order_no |
| | | , (select count(1) from t_order_item_sales sa where sa.order_item_id = oi.id) salesNum |
| | | FROM t_delivery_order_item doi |
| | | join t_delivery_order q on q.id = doi.delivery_id |
| | |
| | | <select id="selectDoItemList4Check" resultType="com.mzl.flower.dto.response.payment.DeliveryOrderItem4CheckDTO"> |
| | | SELECT oi.id, q.delivery_id, oi.flower_name, oi.flower_unit, oi.flower_color |
| | | , oi.flower_cover, oi.num , oi.supplier_price price, oi.flower_level, oi.status |
| | | , (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'replace') replaceNum |
| | | , (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'reduce') reduceNum |
| | | , (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'lack') lackNum |
| | | , (select oic.num from t_order_item_check oic |
| | | where oic.order_item_id = oi.id and oic.type = 'replace' |
| | | and (oic.audit_status = 'AGREED' or oic.audit_status is null) |
| | | ) replaceNum |
| | | , (select oic.num from t_order_item_check oic |
| | | where oic.order_item_id = oi.id and oic.type = 'reduce' |
| | | and (oic.audit_status = 'AGREED' or oic.audit_status is null) |
| | | ) reduceNum |
| | | , (select oic.num from t_order_item_check oic |
| | | where oic.order_item_id = oi.id and oic.type = 'lack' |
| | | and (oic.audit_status = 'AGREED' or oic.audit_status is null) |
| | | ) lackNum |
| | | FROM t_delivery_order_item q |
| | | join t_order_item oi on oi.id = q.order_item_id |
| | | WHERE q.deleted = 0 and oi.deleted = 0 |
| | |
| | | </select> |
| | | |
| | | <select id="selectSupplierDoList4Check" resultType="com.mzl.flower.dto.response.payment.DeliveryOrderList4CheckDTO"> |
| | | SELECT tt.id, tt.supplierName, tt.supplierTel, tt.stationName, sum(tt.num) totalNum, sum(tt.amount) totalAmount |
| | | SELECT tt.id, tt.supplierName, tt.supplierTel, tt.stationName, sum(tt.num) totalNum |
| | | , sum(tt.amount) totalAmount, sum(tt.uncheckedCount) uncheckedCount |
| | | from ( |
| | | select s.id, s.name supplierName, s.contact_tel supplierTel, st.name stationName |
| | | , (select sum(num) from t_order_item oi |
| | | where oi.supplier_id = q.supplier_id and oi.order_id = q.order_id) num |
| | | , (select sum(oi.supplier_price * oi.num) from t_order_item oi |
| | | , (select sum(oi.supplier_price * oi.num) from t_order_item oi |
| | | where oi.supplier_id = q.supplier_id and oi.order_id = q.order_id) amount |
| | | , (select count(1) from t_delivery_order dor |
| | | where dor.id = q.id and dor.status != 'CHECKED') uncheckedCount |
| | | from t_supplier_info s |
| | | join t_station st on st.id = s.station_id |
| | | join t_delivery_order q on s.id = q.supplier_id |
| | |
| | | <if test="condition.orderNo != null and condition.orderNo != ''"> |
| | | AND q.order_no LIKE concat('%', #{condition.orderNo},'%') |
| | | </if> |
| | | <if test="condition.status != null and condition.status != ''"> |
| | | AND q.status = #{condition.status} |
| | | |
| | | <if test="condition.statusList != null and condition.statusList.size > 0"> |
| | | AND q.status in |
| | | <foreach collection="condition.statusList" item="status" open="(" separator="," close=")"> |
| | | #{status} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="condition.supplierId != null"> |
| | |
| | | <if test="condition.orderNo != null and condition.orderNo != ''"> |
| | | AND q.order_no LIKE concat('%', #{condition.orderNo},'%') |
| | | </if> |
| | | <if test="condition.status != null and condition.status != ''"> |
| | | AND q.status = #{condition.status} |
| | | |
| | | <if test="condition.statusList != null and condition.statusList.size > 0"> |
| | | AND q.status in |
| | | <foreach collection="condition.statusList" item="status" open="(" separator="," close=")"> |
| | | #{status} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="condition.warehouseId != null"> |
| | |
| | | </select> |
| | | |
| | | <select id="statisticStationList" resultType="com.mzl.flower.dto.response.flower.StationStatisticDTO"> |
| | | select tt.* |
| | | , (select count(distinct s.id) |
| | | from t_supplier_info s |
| | | join t_delivery_order q on s.id = q.supplier_id |
| | | WHERE q.deleted = 0 |
| | | and q.status in ('CHECKED') |
| | | AND s.station_id = tt.stationId |
| | | ) checkedSupplierCount |
| | | , (select count(distinct s.id) |
| | | from t_supplier_info s |
| | | join t_delivery_order q on s.id = q.supplier_id |
| | | WHERE q.deleted = 0 |
| | | and q.status in ('PENDING', 'ARRIVED') |
| | | AND s.station_id = tt.stationId |
| | | ) uncheckedSupplierCount |
| | | from ( |
| | | SELECT |
| | | s.station_id AS stationId, |
| | | st.`name`, |
| | |
| | | <if test="endDate != null"> |
| | | AND o.create_time <= #{endDate} |
| | | </if> |
| | | GROUP BY |
| | | s.station_id, |
| | | st.`name`; |
| | | |
| | | <if test="statusList != null and statusList.size > 0"> |
| | | AND o.status in |
| | | <foreach collection="statusList" item="status" open="(" separator="," close=")"> |
| | | #{status} |
| | | </foreach> |
| | | </if> |
| | | GROUP BY s.station_id, st.`name` |
| | | ) tt |
| | | </select> |
| | | |
| | | <update id="setDeliveryOrderPending"> |
| | |
| | | SELECT q.* |
| | | FROM t_delivery_order q |
| | | WHERE q.deleted = 0 |
| | | and q.status in ('PENDING', 'ARRIVED', 'CHECKED') |
| | | AND q.status in ('PENDING', 'ARRIVED') |
| | | AND q.supplier_id = #{supplierId} |
| | | AND q.create_time > #{startDate} |
| | | AND q.create_time <= #{endDate} |
| | | <if test="startDate != null"> |
| | | AND q.create_time > #{startDate} |
| | | </if> |
| | | <if test="endDate != null"> |
| | | AND q.create_time <= #{endDate} |
| | | </if> |
| | | </select> |
| | | </mapper> |
| | |
| | | , (select oic.audit_status from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'reduce') reduceStatus |
| | | , (select oic.audit_status from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'lack') lackStatus |
| | | , (select count(1) from t_order_item_check oic where oic.order_item_id = oi.id and oic.audit_status is null) unProcessCount |
| | | , ois.lack_fee_supplier, ois.replace_fee, ois.check_fee |
| | | FROM t_order_item oi |
| | | left join t_station s on s.id = oi.station_id |
| | | left join t_supplier_info si on si.id = oi.supplier_id |
| | | left join t_order_item_settlement ois on ois.order_item_id = oi.id |
| | | WHERE oi.deleted = 0 |
| | | and oi.order_id = #{orderId} |
| | | </select> |
| | | |
| | | <select id="getOrderItems" resultType="com.mzl.flower.dto.response.payment.OrderItemListDTO"> |
| | | SELECT oi.* |
| | | , (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'replace' and oic.audit_status = 'AGREED') replaceNum |
| | | , (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'reduce' and oic.audit_status = 'AGREED') reduceNum |
| | | , (select oic.num from t_order_item_check oic where oic.order_item_id = oi.id and oic.type = 'lack' and oic.audit_status = 'AGREED') lackNum |
| | | FROM t_order_item oi |
| | | WHERE oi.deleted = 0 |
| | | and oi.order_id in |
| | | <foreach collection="orderIds" item="orderId" open="(" separator="," close=")"> |
| | | #{orderId} |
| | | </foreach> |
| | | </select> |
| | | </mapper> |
| | |
| | | and o.receive_time < #{endTime} |
| | | and o.bill_id is null |
| | | </select> |
| | | |
| | | <select id="getUserLastOrder" resultType="com.mzl.flower.entity.payment.Order"> |
| | | select o.* |
| | | from t_order o |
| | | where o.receive_time is not null |
| | | AND o.create_by = #{userId} |
| | | order by o.receive_time desc |
| | | limit 1 |
| | | </select> |
| | | |
| | | <select id="getPointGoodsList" resultType="com.mzl.flower.dto.response.payment.OrderPointGoodsListDTO"> |
| | | select gr.* |
| | | from t_point_goods_record gr |
| | | join t_order_point_goods opg on opg.goods_record_id = gr.id |
| | | where opg.order_id = #{orderId} |
| | | </select> |
| | | <select id="getFlowerCompleteNumToday" resultType="java.lang.Integer"> |
| | | select IFNULL(sum(oi.num),0) as complete_num |
| | | from t_order o |
| | | left join t_order_item oi |
| | | on o.id=oi.order_id |
| | | where o.DELETEd=0 and oi.DELETEd=0 |
| | | and o.status_backend not in ('PENDING','CANCEL','REFUND') |
| | | and o.create_by=#{userId} |
| | | AND oi.flower_id=#{flowerId} |
| | | AND o.complete_time BETWEEN DATE_SUB(CURDATE(), INTERVAL 1 DAY) + INTERVAL 17 HOUR AND CURDATE() + INTERVAL 17 HOUR |
| | | </select> |
| | | </mapper> |
| | |
| | | <mapper namespace="com.mzl.flower.mapper.payment.OrderSettlementDetailMapper"> |
| | | |
| | | <select id="selectSettlementDetailList" resultType="com.mzl.flower.dto.response.payment.OrderSettlementDetailDTO"> |
| | | SELECT s.*, oi.flower_name, oi.flower_level |
| | | SELECT s.*, oi.flower_name, oi.flower_level, o.receive_time, oi.check_time, o.order_no, s.order_id |
| | | FROM t_order_settlement_detail s |
| | | join t_order_item oi on oi.id = s.order_item_id |
| | | join t_order o on o.id = s.order_id |
| | | WHERE s.deleted = 0 |
| | | AND s.settlement_id = #{settlementId} |
| | | ORDER BY s.create_time desc |
| | | ORDER BY o.receive_time desc, o.id, oi.flower_name |
| | | </select> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.mzl.flower.mapper.point.CustomerPointDetailMapper"> |
| | | <select id="queryPage" resultType="com.mzl.flower.dto.response.point.CustomerPointDetailVO"> |
| | | select * from t_customer_point_detail t where t.deleted= 0 |
| | | <if test="dto.userId != null and dto.userId != ''"> |
| | | and t.userId = #{dto.userId} |
| | | </if> |
| | | <if test="dto.customerId != null and dto.customerId != ''"> |
| | | and t.customerId = #{dto.customerId} |
| | | </if> |
| | | <if test="dto.changeType != null and dto.changeType != ''"> |
| | | and t.changeType = #{dto.changeType} |
| | | </if> |
| | | <if test="dto.type != null and dto.type != ''"> |
| | | and t.type = #{dto.type} |
| | | </if> |
| | | order by t.c desc |
| | | </select> |
| | | <select id="tongjiExpiredPoint" resultType="com.mzl.flower.dto.response.point.ExpiredPointDTO" |
| | | parameterType="java.time.LocalDate"> |
| | | SELECT |
| | | p.user_id, |
| | | p.customer_id, |
| | | SUM(CASE WHEN p.change_type = 'add' THEN point ELSE 0 END) AS addPoint, |
| | | SUM(CASE WHEN p.change_type = 'reduce' THEN point ELSE 0 END) AS reducePoint |
| | | FROM |
| | | t_customer_point_detail p |
| | | WHERE p.deleted= 0 |
| | | <if test="lastYear!=null "> |
| | | <![CDATA[ |
| | | and p.record_date <= #{lastYear} |
| | | ]]> |
| | | </if> |
| | | <if test="userId!=null and userId!=''"> |
| | | and p.user_id = #{userId} |
| | | </if> |
| | | GROUP BY |
| | | p.user_id, |
| | | p.customer_id |
| | | </select> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.mzl.flower.mapper.point.CustomerPointMapper"> |
| | | <select id="queryPage" resultType="com.mzl.flower.dto.response.point.CustomerPointDTO"> |
| | | SELECT |
| | | c.`name` as customerName, |
| | | c.user_id as userId, |
| | | p.id as id, |
| | | c.id as customerId, |
| | | IFNULL(p.total_point, 0) as totalPoint, |
| | | IFNULL(p.used_point, 0) as usedPoint, |
| | | IFNULL(p.expired_point, 0) as expiredPoint, |
| | | IFNULL(p.deduction_point, 0) as deductionPoint, |
| | | t.tel as customerTel |
| | | FROM |
| | | t_customer_info c |
| | | LEFT JOIN t_customer_point p ON c.id = p.customer_id |
| | | LEFT JOIN t_user t on c.user_id = t.id |
| | | WHERE |
| | | c.deleted = 0 |
| | | <if test="dto.customerName!= null and dto.customerName != ''"> |
| | | AND c.`name` LIKE CONCAT('%',#{dto.customerName},'%') |
| | | </if> |
| | | <if test="dto.customerTel!= null and dto.customerTel != ''"> |
| | | and t.tel like CONCAT('%',#{dto.customerTel},'%') |
| | | </if> |
| | | order by p.create_time desc |
| | | |
| | | </select> |
| | | <select id="queryCustomerDetails" resultType="com.mzl.flower.dto.response.point.CustomerPointDetailDTO"> |
| | | SELECT * from t_customer_point_detail t where t.deleted= 0 |
| | | <if test="dto.customerId!= null and dto.customerId != 0"> |
| | | and t.customer_id = #{dto.customerId} |
| | | </if> |
| | | <if test="dto.userId!= null and dto.userId != ''"> |
| | | and t.user_id = #{dto.userId} |
| | | </if> |
| | | <if test="dto.recordDateStart!=null and dto.recordDateStart!='' "> |
| | | <![CDATA[ |
| | | AND t.record_date >= #{dto.recordDateStart} |
| | | ]]> |
| | | </if> |
| | | <if test="dto.recordDateEnd!=null and dto.recordDateEnd!='' "> |
| | | <![CDATA[ |
| | | AND t.record_date <= #{dto.recordDateEnd} |
| | | ]]> |
| | | </if> |
| | | <if test="dto.type!=null and dto.type != null"> |
| | | and t.type = #{dto.type} |
| | | </if> |
| | | <if test="dto.remarks!=null and dto.remarks != null"> |
| | | and t.remarks like CONCAT('%',#{dto.remarks},'%') |
| | | </if> |
| | | order by t.create_time desc |
| | | </select> |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.mzl.flower.mapper.point.PointGoodsRecordMapper"> |
| | | <update id="updateExpiredPointGoodsRecord"> |
| | | update t_point_goods_record p set p.`status`='E' where p.deleted = 0 and p.`status` = 'A' and |
| | | <![CDATA[ |
| | | p.expire_time < NOW() |
| | | ]]> |
| | | |
| | | </update> |
| | | |
| | | <select id="selectMyExchangeGoods" resultType="com.mzl.flower.dto.response.point.PointGoodsRecordDTO"> |
| | | SELECT |
| | | * |
| | | FROM |
| | | t_point_goods_record p |
| | | WHERE |
| | | p.deleted = 0 |
| | | <if test="dto.userId != null and dto.userId != ''"> |
| | | AND p.user_id = #{dto.userId} |
| | | </if> |
| | | <if test="dto.status != null and dto.status != ''"> |
| | | AND p.`status` = #{dto.status} |
| | | </if> |
| | | ORDER BY |
| | | p.create_time DESC |
| | | </select> |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.mzl.flower.mapper.point.PointGoodsMapper"> |
| | | |
| | | <select id="selectGoodsList" resultType="com.mzl.flower.dto.response.point.PointGoodsListDTO"> |
| | | SELECT p.* |
| | | FROM t_point_goods p |
| | | WHERE p.deleted = 0 |
| | | <if test="condition.name != null and condition.name != ''"> |
| | | AND p.name LIKE concat('%', #{condition.name},'%') |
| | | </if> |
| | | <if test="condition.status != null and condition.status != ''"> |
| | | AND p.status = #{condition.status} |
| | | </if> |
| | | <if test="condition.stockLower != null"> |
| | | AND p.stock > #{condition.stockLower} |
| | | </if> |
| | | <if test="condition.stockUpper != null"> |
| | | AND p.stock <= #{condition.stockUpper} |
| | | </if> |
| | | <if test="condition.pointLower != null"> |
| | | AND p.point >= #{condition.pointLower} |
| | | </if> |
| | | <if test="condition.pointUpper != null"> |
| | | AND p.point <= #{condition.pointUpper} |
| | | </if> |
| | | ORDER BY p.create_time desc |
| | | </select> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | ==================================================20240831 |
| | | ALTER TABLE `t_order` ADD `member_coupon_id` varchar(50) COMMENT '用户优惠券id'; |
| | | ALTER TABLE `t_order` ADD `member_coupon_code` varchar(50) COMMENT '优惠券编码'; |
| | | ALTER TABLE `t_order` ADD `member_coupon_name` varchar(50) COMMENT '优惠券名称'; |
| | | ALTER TABLE `t_order` ADD `member_coupon_amount` DECIMAL(11,2) COMMENT '优惠券金额'; |
| | | ALTER TABLE `t_order` ADD `member_id` bigint(25) COMMENT '会员等级id'; |
| | | ALTER TABLE `t_order` ADD `member_name` varchar(50) COMMENT '会员等级名称'; |
| | | ALTER TABLE `t_order` ADD `member_discount_type` varchar(50) COMMENT '折扣类型(discount_type)'; |
| | | ALTER TABLE `t_order` ADD `member_discount_ratio` DECIMAL(11,2) COMMENT '会员折扣'; |
| | | ALTER TABLE `t_order` ADD `member_discount_amount` DECIMAL(11,2) COMMENT '优惠金额(每扎)'; |
| | | |
| | | ALTER TABLE `t_order_item` ADD `coupon_amount` DECIMAL(11,2) COMMENT '优惠券金额/扎'; |
| | | ALTER TABLE `t_order_item` ADD `original_price` DECIMAL(11,2) COMMENT '优惠前售价/扎'; |
| | | ALTER TABLE `t_order_item` ADD `real_price` DECIMAL(11,2) COMMENT '真实成交价格/每扎'; |
| | | |
| | | INSERT INTO t_code_value(ID,TYPE_CODE,VALUE,LABEL,DESCRIPTION,SEQ,STATUS) VALUES ('POINT_GOODS_STATUS_A','POINT_GOODS_STATUS','A','上架','上架',1,'A'); |
| | | INSERT INTO t_code_value(ID,TYPE_CODE,VALUE,LABEL,DESCRIPTION,SEQ,STATUS) VALUES ('POINT_GOODS_STATUS_I','POINT_GOODS_STATUS','I','下架','下架',2,'A'); |
| | | |
| | | ALTER TABLE `t_bill` ADD `member_coupon_amount` DECIMAL(11,2) COMMENT '优惠券金额'; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
对比新文件 |
| | |
| | | CREATE TABLE `flower`.`t_coupon_template` ( |
| | | `id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键', |
| | | `coupon_code` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '优惠券代码(唯一)', |
| | | `coupon_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '优惠券名称', |
| | | `coupon_description` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '优惠券描述(使用规则)', |
| | | `coupon_amount` int(11) NULL DEFAULT NULL COMMENT '发放数量', |
| | | `coupon_discount_type` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '优惠券类型(COUPON_TYPE)满减和无门槛', |
| | | `coupon_discount_value` decimal(10, 2) NULL DEFAULT NULL COMMENT '优惠券面值 折扣值(百分比或金额)', |
| | | `min_order_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '使用条件,最小订单金额(可选)=》使用条件', |
| | | `max_discount_amount` decimal(10, 2) NULL DEFAULT NULL COMMENT '最大折扣金额(可选,仅对百分比折扣类型适用)', |
| | | `get_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领取渠道(COUPON_GET_TYPE)首页弹窗、活动入口、领券中心', |
| | | `get_user_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领取用户类型(COUPON_GET_USER_TYPE)全部用户,指定用户', |
| | | `get_start_date` datetime NULL DEFAULT NULL COMMENT '领取开始时间', |
| | | `get_end_date` datetime NULL DEFAULT NULL COMMENT '领取结束时间', |
| | | `get_limit` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '每人限领', |
| | | `usage_type` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '使用时间类型(COUPON_USAGE_TYPE)与领取时间一致、固定时间、领取后有效', |
| | | `usage_time_type` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '领取后有效类型(COUPON_USAGE_TIME_TYPE)天、小时、分钟', |
| | | `usage_time_num` int(11) NULL DEFAULT NULL COMMENT '领取后有效时间整数,比如90(天,小时,分钟)', |
| | | `usage_limit` int(11) NULL DEFAULT NULL COMMENT '使用次数限制', |
| | | `usage_per_user` int(11) NULL DEFAULT NULL COMMENT '每个用户的使用次数限制', |
| | | `usage_start_date` datetime NULL DEFAULT NULL COMMENT '使用开始时间', |
| | | `usage_end_date` datetime NULL DEFAULT NULL COMMENT '使用结束时间', |
| | | `status` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT 'active' COMMENT '优惠券状态(COUPON_STATUS)', |
| | | `vip_flag` tinyint(4) NULL DEFAULT 0 COMMENT '会员标志', |
| | | `vip_grade` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '会员等级', |
| | | `create_by` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人', |
| | | `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| | | `update_by` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '更新人', |
| | | `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', |
| | | `deleted` tinyint(4) NULL DEFAULT 0 COMMENT '删除标志', |
| | | PRIMARY KEY (`id`) USING BTREE, |
| | | UNIQUE INDEX `coupon_code`(`coupon_code`) USING BTREE |
| | | ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; |
| | |
| | | 6、计算上月供应商销售数量:每月1日凌晨执行一次 |
| | | 7、自动收货:每隔1小时执行一次 |
| | | 8、结算:每日凌晨0点钟执行 |
| | | 9、确认转账:每隔10分钟执行一次 |
| | | 9、确认转账:每隔10分钟执行一次 |
| | | 10、统计过期积分:凌晨1:10执行一次 |