记得上下班打卡 | git大法好,push需谨慎

Commit b5ca8b47 authored by 张国柄's avatar 张国柄

~券结构调整:废除`candy_coupon.exclusive`,新增`candy_mgt_coupon.exclusively`、`candy_comm...

~券结构调整:废除`candy_coupon.exclusive`,新增`candy_mgt_coupon.exclusively`、`candy_common_coupon.exclusive`、`candy_user_coupon.exclusive`
parent 5477b4da
......@@ -34,6 +34,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -248,6 +249,32 @@ public class AdamMemberAdminController extends BaseController {
@PostMapping("edit_coupon")
@ResponseBody
public AjaxResult editCoupon(@RequestBody @Validated CandyMemberCouponMatchParam parameter) {
switch (parameter.getBusiType()) {// 券类别类型配置校验
case 0:
case 1:
if (!Arrays.asList(1, 2).contains(parameter.getCouType())) {
String msg = String.format("会员券类别【%s】", parameter.getBusiType() == 0 ? "全场" : "演出");
logger.warn("{}暂不支持所选券类型[{}]", msg, parameter.getCouType());
return this.error(AjaxResult.Type.WARN, String.format("%s暂不支持所选券类型", msg));
}
break;
case 2:
if (!Arrays.asList(1, 2, 3).contains(parameter.getCouType())) {
logger.warn("券类别【商品】暂不支持所选券类型[{}]", parameter.getCouType());
return this.error(AjaxResult.Type.WARN, "会员券类别【商品】暂不支持所选券类型");
}
break;
case 3:
if (101 != parameter.getCouType()) {
logger.warn("会员券类别【优先购买】暂不支持所选券类型[{}]", parameter.getCouType());
return this.error(AjaxResult.Type.WARN, "会员券类别【优先购买】暂不支持所选券类型");
}
break;
default:
logger.warn("Invalid argument[parameter.busiType={}]", parameter.getBusiType());
return this.error(AjaxResult.Type.WARN, "无效的券类别");
}
LambdaQueryWrapper<AdamMemberRights> memberRightsLambdaQueryWrapper = Wrappers.lambdaQuery();
memberRightsLambdaQueryWrapper.eq(AdamMemberRights::getMrightsId, parameter.getMrightsId());
memberRightsLambdaQueryWrapper.eq(AdamMemberRights::getState, 1);
......
......@@ -228,6 +228,7 @@ public class CandyMgtCouponAdminServiceImpl extends ServiceImpl<CandyMgtCouponMa
mgtCouponOper.setEventType(2);
//mgtCouponOper.setEventLimit();
//mgtCouponOper.setEventAt();
mgtCouponOper.setExclusively(1);
mgtCouponOper.setOperator(operator);
mgtCouponOper.setCreatedAt(nowTime);
......@@ -298,6 +299,7 @@ public class CandyMgtCouponAdminServiceImpl extends ServiceImpl<CandyMgtCouponMa
mgtCouponOper.setState(10);// 发放状态[0-未发放|1-已发放|2-无效|9-发放中|10-会员礼包初始模版]
mgtCouponOper.setEventAmt(parameter.getEventAmt());
mgtCouponOper.setEventType(2);
mgtCouponOper.setExclusively(1);
mgtCouponOper.setOperator(operator);
mgtCouponOper.setCreatedAt(nowTime);
......
......@@ -19,7 +19,7 @@ public class CandyCommonCouponBasicDto implements Serializable ,Cloneable{
private String title;
private String label;
private String notice;
private Integer exclusive;
//private Integer exclusive;
private Integer busiType;
private Integer couType;
private Integer bindType;
......@@ -44,6 +44,7 @@ public class CandyCommonCouponBasicDto implements Serializable ,Cloneable{
private String ccouponId;
private String mcouponId;
//private String couponId;
private Integer exclusive;
private Integer state;
private Integer ranged;
//private String operator;
......@@ -71,7 +72,7 @@ public class CandyCommonCouponBasicDto implements Serializable ,Cloneable{
this.setTitle(coupon.getTitle());
this.setLabel(coupon.getLabel());
this.setNotice(coupon.getNotice());
this.setExclusive(coupon.getExclusive());
//this.setExclusive(coupon.getExclusive());
this.setBusiType(coupon.getBusiType());
this.setCouType(coupon.getCouType());
this.setBindType(coupon.getBindType());
......@@ -90,6 +91,7 @@ public class CandyCommonCouponBasicDto implements Serializable ,Cloneable{
this.setCcouponId(commonCoupon.getCcouponId());
this.setMcouponId(commonCoupon.getMcouponId());
this.setExclusive(commonCoupon.getExclusive());
this.setState(commonCoupon.getState());
this.setRanged(commonCoupon.getRanged());
this.setCreatedAt(commonCoupon.getCreatedAt());
......
......@@ -19,7 +19,7 @@ public class CandyUserCouponBasicDto implements Serializable, Cloneable {
private String title;
private String label;
private String notice;
private Integer exclusive;
//private Integer exclusive;
private Integer busiType;
private Integer couType;
private Integer bindType;
......@@ -45,6 +45,7 @@ public class CandyUserCouponBasicDto implements Serializable, Cloneable {
private String mcouponId;
private String uid;
//private String couponId;
private Integer exclusive;
private Integer state;
private String ccode;
private LocalDateTime bindAt;
......@@ -77,7 +78,7 @@ public class CandyUserCouponBasicDto implements Serializable, Cloneable {
this.setTitle(coupon.getTitle());
this.setLabel(coupon.getLabel());
this.setNotice(coupon.getNotice());
this.setExclusive(coupon.getExclusive());
//this.setExclusive(coupon.getExclusive());
this.setBusiType(coupon.getBusiType());
this.setCouType(coupon.getCouType());
this.setBindType(coupon.getBindType());
......@@ -95,6 +96,7 @@ public class CandyUserCouponBasicDto implements Serializable, Cloneable {
this.setUcouponId(userCoupon.getUcouponId());
this.setMcouponId(userCoupon.getMcouponId());
this.setUid(userCoupon.getUid());
this.setExclusive(userCoupon.getExclusive());
this.setState(userCoupon.getState());
this.setCcode(userCoupon.getCcode());
this.setBindAt(userCoupon.getBindAt());
......
......@@ -37,6 +37,18 @@ public class CandyCommonCoupon implements Serializable {
*/
private String couponId;
/**
* 专享标识[0-常规|1-会员专属]
* <p>
* 变更前:`candy_coupon.exclusive`用于根据会员有效期设置券有效期及标识用户端券分类(普通券、会员券等);
* 变更后:
* 原`candy_coupon.exclusive`废除
* 实际发放逻辑中,原标识"是否根据会员有效期设置券有效期"的`candy_coupon.exclusive`字段改为`candy_mgt_coupon.exclusively`
* 在`candy_user_coupon`及`candy_common_coupon`中添加`exclusive`字段,发放时直接由`candy_mgt_coupon.exclusively`赋值该属性
* </p>
*/
private Integer exclusive;
/**
* 公有券状态[1-可用|2-无效|3-已过期]
*/
......
......@@ -2,11 +2,12 @@ package com.liquidnet.service.candy.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* <p>
* 券发放管理
......@@ -59,8 +60,11 @@ public class CandyMgtCoupon implements Serializable {
/**
* 专享标识[0-常规|1-会员专属]
* <p>
* 同`candy_coupon.exclusive`,按实际需求场景灵活使用;
* 目前`candy_coupon.exclusive`用于根据会员有效期设置券有效期;
* 变更前:`candy_coupon.exclusive`用于根据会员有效期设置券有效期及标识用户端券分类(普通券、会员券等);
* 变更后:
* 原`candy_coupon.exclusive`废除
* 实际发放逻辑中,原标识"是否根据会员有效期设置券有效期"的`candy_coupon.exclusive`字段改为`candy_mgt_coupon.exclusively`
* 在`candy_user_coupon`及`candy_common_coupon`中添加`exclusive`字段,发放时直接由`candy_mgt_coupon.exclusively`赋值该属性
* </p>
*/
private Integer exclusively;
......
......@@ -43,6 +43,18 @@ public class CandyUserCoupon implements Serializable,Cloneable {
*/
private String couponId;
/**
* 专享标识[0-常规|1-会员专属]
* <p>
* 变更前:`candy_coupon.exclusive`用于根据会员有效期设置券有效期及标识用户端券分类(普通券、会员券等);
* 变更后:
* 原`candy_coupon.exclusive`废除
* 实际发放逻辑中,原标识"是否根据会员有效期设置券有效期"的`candy_coupon.exclusive`字段改为`candy_mgt_coupon.exclusively`
* 在`candy_user_coupon`及`candy_common_coupon`中添加`exclusive`字段,发放时直接由`candy_mgt_coupon.exclusively`赋值该属性
* </p>
*/
private Integer exclusive;
/**
* 用户券状态[1-可用|2-无效|3-已过期|5-已使用]
*/
......
......@@ -8,7 +8,7 @@
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="label" jdbcType="VARCHAR" property="label"/>
<result column="notice" jdbcType="VARCHAR" property="notice"/>
<result column="exclusive" jdbcType="SMALLINT" property="exclusive"/>
<!-- <result column="exclusive" jdbcType="SMALLINT" property="exclusive"/>-->
<result column="busi_type" jdbcType="SMALLINT" property="busiType"/>
<result column="cou_type" jdbcType="SMALLINT" property="couType"/>
<result column="bind_type" jdbcType="SMALLINT" property="bindType"/>
......@@ -32,6 +32,7 @@
<result column="ccoupon_id" jdbcType="VARCHAR" property="ccouponId"/>
<result column="mcoupon_id" jdbcType="VARCHAR" property="mcouponId"/>
<!-- <result column="coupon_id" jdbcType="VARCHAR" property="couponId" />-->
<result column="exclusive" jdbcType="SMALLINT" property="exclusive"/>
<result column="state" jdbcType="TINYINT" property="state"/>
<result column="ranged" jdbcType="TINYINT" property="ranged"/>
<!-- <result column="operator" jdbcType="VARCHAR" property="operator" />-->
......@@ -41,11 +42,11 @@
</resultMap>
<sql id="Rst_CommonCouponBasicDto_Column_List">
cc.coupon_id, cc.title, cc.`label`, cc.notice, cc.`exclusive`, cc.busi_type, cc.cou_type, cc.bind_type,
cc.coupon_id, cc.title, cc.`label`, cc.notice, cc.busi_type, cc.cou_type, cc.bind_type,
cc.discount, cc.val_face, cc.val_over, cc.val_minus, cc.`overlay`, cc.overlay_level,
cc.validity, cc.redeem_validity, cc.redeem_start, cc.redeem_stop, cc.effect_at, cc.expire_at,
ccc.ccoupon_id, ccc.mcoupon_id, ccc.`state`, ccc.ranged, ccc.created_at
ccc.ccoupon_id, ccc.mcoupon_id, ccc.`exclusive`, ccc.`state`, ccc.ranged, ccc.created_at
</sql>
<select id="selectMultiForCommonCouponBasicDto" resultMap="Rst_CommonCouponBasicDto">
......
......@@ -8,7 +8,7 @@
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="label" jdbcType="VARCHAR" property="label"/>
<result column="notice" jdbcType="VARCHAR" property="notice"/>
<result column="exclusive" jdbcType="SMALLINT" property="exclusive"/>
<!-- <result column="exclusive" jdbcType="SMALLINT" property="exclusive"/>-->
<result column="busi_type" jdbcType="SMALLINT" property="busiType"/>
<result column="cou_type" jdbcType="SMALLINT" property="couType"/>
<result column="bind_type" jdbcType="SMALLINT" property="bindType"/>
......@@ -33,6 +33,7 @@
<!-- <result column="mcoupon_id" jdbcType="VARCHAR" property="mcouponId" />-->
<result column="uid" jdbcType="VARCHAR" property="uid"/>
<!-- <result column="coupon_id" jdbcType="VARCHAR" property="couponId" />-->
<result column="exclusive" jdbcType="SMALLINT" property="exclusive"/>
<result column="state" jdbcType="TINYINT" property="state"/>
<result column="ccode" jdbcType="VARCHAR" property="ccode"/>
<result column="bind_at" jdbcType="TIMESTAMP" property="bindAt"/>
......@@ -43,11 +44,11 @@
</resultMap>
<sql id="Rst_UserCouponBasicDto_Column_List">
cc.coupon_id, cc.title, cc.`label`, cc.notice, cc.`exclusive`, cc.busi_type, cc.cou_type, cc.bind_type,
cc.coupon_id, cc.title, cc.`label`, cc.notice, cc.busi_type, cc.cou_type, cc.bind_type,
cc.discount, cc.val_face, cc.val_over, cc.val_minus, cc.`overlay`, cc.overlay_level,
cc.validity, cc.redeem_validity, cc.redeem_start, cc.redeem_stop,
cuc.ucoupon_id, cuc.mcoupon_id, cuc.`uid`, cuc.`state`, cuc.ccode, cuc.bind_at, cuc.dued_at, cuc.used_at, cuc.used_for
cuc.ucoupon_id, cuc.mcoupon_id, cuc.`uid`, cuc.`exclusive`, cuc.`state`, cuc.ccode, cuc.bind_at, cuc.dued_at, cuc.used_at, cuc.used_for
</sql>
<select id="selectMultiForUserCouponBasicDto" resultMap="Rst_UserCouponBasicDto">
......
......@@ -151,8 +151,16 @@ create table candy_common_coupon
comment varchar(255)
) engine = InnoDB comment '公有券信息';
-- >>------------------------------------------------------------------------------------|20211125会员券发放调整
# `candy_coupon.exclusive`,按实际需求场景灵活使用,目前`candy_coupon.exclusive`用于根据会员有效期设置券有效期;
alter table candy_mgt_coupon add exclusively int default 0 null comment '专享标识[0-常规|1-会员专属]' after event_at;
# 专享标识[0-常规|1-会员专属]
# <p>
# 变更前:`candy_coupon.exclusive`用于根据会员有效期设置券有效期及标识用户端券分类(普通券、会员券等);
# 变更后:
# `candy_coupon.exclusive`废除
# 实际发放逻辑中,原标识"是否根据会员有效期设置券有效期"`candy_coupon.exclusive`字段改为`candy_mgt_coupon.exclusively`
# `candy_user_coupon``candy_common_coupon`中添加`exclusive`字段,发放时直接由`candy_mgt_coupon.exclusively`赋值该属性
alter table candy_mgt_coupon add exclusively smallint default 0 null comment '专享标识[0-常规|1-会员专属]' after event_at;
alter table candy_user_coupon add exclusive smallint null comment '专享标识[0-常规|1-会员礼包]' after coupon_id;
alter table candy_common_coupon add exclusive smallint null comment '专享标识[0-常规|1-会员礼包]' after coupon_id;
-- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------
......
......@@ -161,6 +161,7 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
commonCoupon.setCcouponId(IDGenerator.nextTimeId2());
commonCoupon.setMcouponId(mgtCoupon.getMcouponId());
commonCoupon.setCouponId(coupon.getCouponId());
commonCoupon.setExclusive(mgtCoupon.getExclusively());
commonCoupon.setState(1);
commonCoupon.setRanged(mgtCoupon.getEventType());
commonCoupon.setOperator("system");
......@@ -211,7 +212,8 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
log.info("发放券处理中:目标全体会员[总数:{},发放量:{}]", userMemberCount, eventAmt);
// 会员权益券失效时间duedAt需要同步会员到期时间expiryAt
boolean isMemberRightsCoupon = coupon.getExclusive() == 1;
Integer exclusively = mgtCoupon.getExclusively();
boolean isMemberRightsCoupon = exclusively == 1;
queryWrapper.select(AdamUserMember::getUid).orderByAsc(AdamUserMember::getMid);
while (totalCount > 0) {
initUserCouponList.clear();
......@@ -231,6 +233,7 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
userCoupon.setMcouponId(mgtCoupon.getMcouponId());
userCoupon.setUid(userMember.getUid());
userCoupon.setCouponId(coupon.getCouponId());
userCoupon.setExclusive(exclusively);
userCoupon.setState(1);
userCoupon.setBindAt(coupon.getEffectAt());
// userCoupon.setDuedAt(coupon.getExpireAt());
......@@ -292,7 +295,8 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
AbstractRedisUtil redisAdamUtil = redisDataSourceUtil.getRedisAdamUtil();
// 指定手机号发放券中,会员权益券失效时间duedAt需要同步会员到期时间expiryAt
boolean isMemberRightsCoupon = coupon.getExclusive() == 1;
Integer exclusively = mgtCoupon.getExclusively();
boolean isMemberRightsCoupon = exclusively == 1;
for (int i = 0; i < eventAmt; i++) {
for (String r : eventLimitArr) {
String uid = (String) redisAdamUtil.get(AdamRedisConst.IDENTITY_MOBILE.concat(r));
......@@ -303,6 +307,7 @@ public class PlatformCandyCouponService extends ServiceImpl<CandyCouponMapper, C
userCoupon.setMcouponId(mgtCoupon.getMcouponId());
userCoupon.setUid(uid);
userCoupon.setCouponId(coupon.getCouponId());
userCoupon.setExclusive(exclusively);
userCoupon.setState(1);
userCoupon.setBindAt(coupon.getEffectAt());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment