提交
This commit is contained in:
parent
46a8b4abbd
commit
4222136359
|
@ -23,6 +23,8 @@ public class DictTypeConstants {
|
|||
public static final String CUSTOMER_SERVICE_TYPE = "customer_service_type";
|
||||
// 充值渠道类型
|
||||
public static final String RECHARGE_CHANNEL_TYPE = "recharge_channel_type";
|
||||
// 会员等级状态
|
||||
public static final String VIP_LEVEL_STATUS = "vip_level_status";
|
||||
// 会员等级SKU状态
|
||||
public static final String VIP_LEVEL_SKU_STATUS = "vip_level_sku_status";
|
||||
// 会员等级SKU限制类型
|
||||
public static final String VIP_LEVEL_SKU_LIMIT_TYPE = "vip_level_sku_limit_type";
|
||||
}
|
||||
|
|
|
@ -43,4 +43,7 @@ public class SmUserQuery extends SmUser {
|
|||
|
||||
@ApiModelProperty("精准身份证号")
|
||||
private String eqRealIdCard;
|
||||
|
||||
@ApiModelProperty("用户类型列表")
|
||||
private List<String> types;
|
||||
}
|
||||
|
|
|
@ -113,6 +113,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="types != null and types.size() > 0">
|
||||
and su.type in
|
||||
<foreach collection="types" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectSmUserList" parameterType="SmUserQuery" resultMap="SmUserResult">
|
||||
|
|
|
@ -57,5 +57,25 @@ public class Vip extends BaseEntity
|
|||
@ApiModelProperty("可用店铺ID列表")
|
||||
private List<Long> storeIds;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "下次重置计数的时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("下次重置计数的时间")
|
||||
private LocalDateTime nextResetTime;
|
||||
|
||||
@Excel(name = "总计使用次数")
|
||||
@ApiModelProperty("总计使用次数")
|
||||
private Integer totalCount;
|
||||
|
||||
@Excel(name = "当前周期使用的次数")
|
||||
@ApiModelProperty("当前周期使用的次数")
|
||||
private Integer roundCount;
|
||||
|
||||
@Excel(name = "限制类型:字典vip_level_sku_limit_type")
|
||||
@ApiModelProperty("限制类型:字典vip_level_sku_limit_type")
|
||||
private String limitType;
|
||||
|
||||
@Excel(name = "限制次数")
|
||||
@ApiModelProperty("限制次数")
|
||||
private Integer limitCount;
|
||||
|
||||
}
|
||||
|
|
|
@ -18,6 +18,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sv.end_time,
|
||||
sv.discount,
|
||||
sv.store_ids,
|
||||
sv.next_reset_time,
|
||||
sv.total_count,
|
||||
sv.round_count,
|
||||
sv.limit_type,
|
||||
sv.limit_count,
|
||||
if(su.is_real, su.real_name, su.user_name) as user_name,
|
||||
svl.name as vip_level_name,
|
||||
svl.mch_id as vip_mch_id
|
||||
|
@ -36,6 +41,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.storeIds != null and query.storeIds != ''"> and sv.store_ids = #{query.storeIds}</if>
|
||||
<if test="query.userName != null and query.userName != ''">and if(su.is_real, su.real_name, su.user_name) like concat('%',#{query.userName},'%')</if>
|
||||
<if test="query.vipLevelName != null and query.vipLevelName != ''">and svl.name like concat('%',#{query.vipLevelName},'%')</if>
|
||||
<if test="query.nextResetTime != null "> and next_reset_time = #{query.nextResetTime}</if>
|
||||
<if test="query.totalCount != null "> and total_count = #{query.totalCount}</if>
|
||||
<if test="query.roundCount != null "> and round_count = #{query.roundCount}</if>
|
||||
<if test="query.limitType != null and query.limitType != ''"> and limit_type = #{query.limitType}</if>
|
||||
<if test="query.limitCount != null "> and limit_count = #{query.limitCount}</if>
|
||||
<if test="query.excludeId != null">and sv.id != #{query.excludeId}</if>
|
||||
<if test="query.vipLevelIds != null and query.vipLevelIds.size() > 0">
|
||||
and sv.level_id in
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
package com.ruoyi.ss.vipLevel.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.constants.DictTypeConstants;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import com.ruoyi.system.valid.DictValid;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
@ -54,9 +52,4 @@ public class VipLevel extends BaseEntity
|
|||
@NotNull(message = "可用店铺ID列表不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||
private List<Long> storeIds;
|
||||
|
||||
@Excel(name = "状态", dictType = DictTypeConstants.VIP_LEVEL_STATUS)
|
||||
@ApiModelProperty("状态")
|
||||
@DictValid(type = DictTypeConstants.VIP_LEVEL_STATUS, allowNull = false, message = "非法的状态")
|
||||
private String status;
|
||||
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
svl.create_time,
|
||||
svl.description,
|
||||
svl.store_ids,
|
||||
svl.status,
|
||||
if (mch.is_real, mch.real_name, mch.user_name) as mch_name
|
||||
from ss_vip_level svl
|
||||
left join sm_user mch on mch.user_id = svl.mch_id
|
||||
|
@ -28,7 +27,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.mchId != null "> and svl.mch_id = #{query.mchId}</if>
|
||||
<if test="query.name != null and query.name != ''"> and svl.name like concat('%', #{query.name}, '%')</if>
|
||||
<if test="query.description != null and query.description != ''"> and svl.description like concat('%', #{query.description}, '%')</if>
|
||||
<if test="query.status != null and query.status != ''"> and svl.status = #{query.status}</if>
|
||||
<if test="query.mchName != null and query.mchName != ''">
|
||||
and if (mch.is_real, mch.real_name, mch.user_name) like concat('%', #{query.mchName}, '%')
|
||||
</if>
|
||||
|
@ -61,7 +59,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createTime != null">create_time,</if>
|
||||
<if test="description != null">`description`,</if>
|
||||
<if test="storeIds != null">store_ids,</if>
|
||||
<if test="status != null and status != ''">`status`,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="mchId != null">#{mchId},</if>
|
||||
|
@ -70,7 +67,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="storeIds != null and storeIds.size() > 0">#{storeIds, typeHandler=com.ruoyi.system.mapper.typehandler.LongSplitListTypeHandler},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -89,7 +85,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||
<if test="data.description != null">`description` = #{data.description},</if>
|
||||
<if test="data.storeIds != null and data.storeIds.size() > 0">store_ids = #{data.storeIds, typeHandler=com.ruoyi.system.mapper.typehandler.LongSplitListTypeHandler},</if>
|
||||
<if test="data.status != null and data.status != ''">`status` = #{data.status},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteVipLevelById" parameterType="Long">
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.ruoyi.common.utils.collection.DiffListVO;
|
|||
import com.ruoyi.ss.vipLevel.domain.VipLevelQuery;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
import com.ruoyi.ss.vipLevel.mapper.VipLevelMapper;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelAssembler;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelService;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelValidator;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuVO;
|
||||
|
@ -35,6 +36,9 @@ public class VipLevelServiceImpl implements VipLevelService
|
|||
@Autowired
|
||||
private VipLevelSkuService vipLevelSkuService;
|
||||
|
||||
@Autowired
|
||||
private VipLevelAssembler vipLevelAssembler;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
|
@ -79,6 +83,9 @@ public class VipLevelServiceImpl implements VipLevelService
|
|||
if (insert == 1) {
|
||||
// SKU表
|
||||
this.batchUpdateSku(vipLevel);
|
||||
|
||||
// 后校验
|
||||
this.afterCheck(vipLevel.getId());
|
||||
}
|
||||
|
||||
return insert;
|
||||
|
@ -87,6 +94,13 @@ public class VipLevelServiceImpl implements VipLevelService
|
|||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
private void afterCheck(Long id) {
|
||||
VipLevelVO vo = this.selectVipLevelById(id);
|
||||
List<VipLevelVO> list = Collections.singletonList(vo);
|
||||
vipLevelAssembler.assembleSkuList(list);
|
||||
vipLevelSkuService.afterCheck(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改会员等级
|
||||
*
|
||||
|
@ -102,6 +116,9 @@ public class VipLevelServiceImpl implements VipLevelService
|
|||
if (update == 1) {
|
||||
// SKU表
|
||||
this.batchUpdateSku(vipLevel);
|
||||
|
||||
// 后校验
|
||||
this.afterCheck(vipLevel.getId());
|
||||
}
|
||||
|
||||
return update;
|
||||
|
@ -129,7 +146,7 @@ public class VipLevelServiceImpl implements VipLevelService
|
|||
result += vipLevelSkuService.batchInsert(diff.getAddList());
|
||||
}
|
||||
if (diff.getUpdateCount() > 0) {
|
||||
result += vipLevelSkuService.batchUpdate(diff.getAddList());
|
||||
result += vipLevelSkuService.batchUpdate(diff.getUpdateList());
|
||||
}
|
||||
if (diff.getDelCount() > 0) {
|
||||
result += vipLevelSkuService.deleteVipLevelSkuByIds(CollectionUtils.map(diff.getDelList(), VipLevelSkuVO::getId));
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package com.ruoyi.ss.vipLevelSku.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.constants.DictTypeConstants;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import com.ruoyi.system.valid.DictValid;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
|
@ -32,4 +36,24 @@ public class VipLevelSku extends BaseEntity
|
|||
@ApiModelProperty("时长(天)")
|
||||
private Integer time;
|
||||
|
||||
@Excel(name = "描述")
|
||||
@ApiModelProperty("描述")
|
||||
private String description;
|
||||
|
||||
@Excel(name = "限制类型", readConverterExp = "1=不限制,2=自然周,3=30天")
|
||||
@ApiModelProperty("限制类型")
|
||||
@NotBlank(message = "限制类型不允许为空", groups = {ValidGroup.Create.class})
|
||||
@DictValid(type = DictTypeConstants.VIP_LEVEL_SKU_LIMIT_TYPE, message = "非法的限制类型")
|
||||
private String limitType;
|
||||
|
||||
@Excel(name = "限制次数")
|
||||
@ApiModelProperty("限制次数")
|
||||
private Integer limitCount;
|
||||
|
||||
@Excel(name = "状态", dictType = DictTypeConstants.VIP_LEVEL_SKU_STATUS)
|
||||
@ApiModelProperty("状态")
|
||||
@NotBlank(message = "状态不允许为空", groups = {ValidGroup.Create.class})
|
||||
@DictValid(type = DictTypeConstants.VIP_LEVEL_SKU_STATUS, message = "非法的状态")
|
||||
private String status;
|
||||
|
||||
}
|
||||
|
|
|
@ -13,13 +13,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
svls.price,
|
||||
svls.time,
|
||||
svls.create_time,
|
||||
svls.update_time
|
||||
svls.update_time,
|
||||
svls.description,
|
||||
svls.limit_type,
|
||||
svls.limit_count,
|
||||
svls.status
|
||||
from ss_vip_level_sku svls
|
||||
</sql>
|
||||
|
||||
<sql id="searchCondition">
|
||||
<if test="query.id != null "> and svls.id = #{query.id}</if>
|
||||
<if test="query.levelId != null "> and svls.level_id = #{query.levelId}</if>
|
||||
<if test="query.description != null and query.description != ''"> and svls.`description` like concat('%',#{query.description},'%')</if>
|
||||
<if test="query.limitType != null and query.limitType != ''"> and svls.limit_type = #{query.limitType}</if>
|
||||
<if test="query.limitCount != null "> and svls.limit_count = #{query.limitCount}</if>
|
||||
<if test="query.status != null and query.status != '' "> and svls.status = #{query.status}</if>
|
||||
<if test="query.levelIds != null and query.levelIds.size() > 0">
|
||||
and svls.level_id in
|
||||
<foreach collection="query.levelIds" item="item" separator="," open="(" close=")">
|
||||
|
@ -50,6 +58,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="time != null">`time`,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="description != null">`description`,</if>
|
||||
<if test="limitType != null and limitType != ''">limit_type,</if>
|
||||
<if test="limitCount != null">limit_count,</if>
|
||||
<if test="status != null and status != ''">`status`,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
|
@ -58,6 +70,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="time != null">#{time},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="limitType != null and limitType != ''">#{limitType},</if>
|
||||
<if test="limitCount != null">#{limitCount},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -69,6 +85,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
`time`,
|
||||
create_time,
|
||||
update_time,
|
||||
`description`,
|
||||
limit_type,
|
||||
limit_count,
|
||||
`status`,
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
|
@ -83,6 +103,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="i.createTime == null ">default,</if>
|
||||
<if test="i.updateTime != null ">#{i.updateTime},</if>
|
||||
<if test="i.updateTime == null ">default,</if>
|
||||
<if test="i.description != null ">#{i.description},</if>
|
||||
<if test="i.description == null ">default,</if>
|
||||
<if test="i.limitType != null and i.limitType != ''">#{i.limitType},</if>
|
||||
<if test="i.limitType == null or i.limitType == ''">default,</if>
|
||||
<if test="i.limitCount != null ">#{i.limitCount},</if>
|
||||
<if test="i.limitCount == null ">default,</if>
|
||||
<if test="i.status != null and i.status != ''">#{i.status},</if>
|
||||
<if test="i.status == null or i.status == ''">default,</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
|
@ -140,6 +168,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="description = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.description != null ">
|
||||
WHEN #{item.id} THEN #{item.description}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `description`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="limit_type = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.limitType != null and item.limitType != ''">
|
||||
WHEN #{item.id} THEN #{item.limitType}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `limit_type`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="limit_count = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.limitCount != null ">
|
||||
WHEN #{item.id} THEN #{item.limitCount}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `limit_count`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="status = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.status != null ">
|
||||
WHEN #{item.id} THEN #{item.status}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `status`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||
|
@ -158,9 +226,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<sql id="updateColumns">
|
||||
<if test="data.levelId != null">level_id = #{data.levelId},</if>
|
||||
<if test="data.price != null">price = #{data.price},</if>
|
||||
<if test="data.time != null">time = #{data.time},</if>
|
||||
<if test="data.time != null">`time` = #{data.time},</if>
|
||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||
<if test="data.updateTime != null">update_time = #{data.updateTime},</if>
|
||||
<if test="data.description != null">`description` = #{data.description},</if>
|
||||
<if test="data.limitType != null and data.limitType != ''">limit_type = #{data.limitType},</if>
|
||||
<if test="data.limitCount != null">limit_count = #{data.limitCount},</if>
|
||||
<if test="data.status != null and data.status != ''">`status` = #{data.status},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteVipLevelSkuById" parameterType="Long">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.ss.vipLevelSku.service;
|
||||
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSku;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuQuery;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuVO;
|
||||
|
@ -79,4 +80,9 @@ public interface VipLevelSkuService
|
|||
* @return
|
||||
*/
|
||||
List<VipLevelSkuVO> selectByLevelIds(List<Long> levelIds);
|
||||
|
||||
/**
|
||||
* 新增、更新后校验
|
||||
*/
|
||||
void afterCheck(VipLevelVO vo);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.ruoyi.ss.vipLevelSku.service.impl;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSku;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuQuery;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuVO;
|
||||
|
@ -143,4 +145,11 @@ public class VipLevelSkuServiceImpl implements VipLevelSkuService
|
|||
query.setLevelIds(levelIds);
|
||||
return vipLevelSkuMapper.selectVipLevelSkuList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCheck(VipLevelVO vo) {
|
||||
ServiceUtil.assertion(vo == null, "校验失败,数据不存在");
|
||||
|
||||
// TODO 校验SKU限制类型与次数是否一致
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user