Commit b9197556 by 吕明尚

Merge branch 'refs/heads/test' into test-lms

parents bcb79f3f 061a7c79
...@@ -35,11 +35,11 @@ public class EquityMembersOrderConfig extends BaseEntity { ...@@ -35,11 +35,11 @@ public class EquityMembersOrderConfig extends BaseEntity {
@Excel(name = "默认会员等级") @Excel(name = "默认会员等级")
private Long defaultLevel; private Long defaultLevel;
/** // /**
* 会员配置id // * 会员配置id
*/ // */
@Excel(name = "会员配置id") // @Excel(name = "会员配置id")
private Long memberConfigId; // private Long memberConfigId;
/** /**
* 所需金额 * 所需金额
...@@ -70,7 +70,6 @@ public class EquityMembersOrderConfig extends BaseEntity { ...@@ -70,7 +70,6 @@ public class EquityMembersOrderConfig extends BaseEntity {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId()) .append("id", getId())
.append("defaultLevel", getDefaultLevel()) .append("defaultLevel", getDefaultLevel())
.append("memberConfigId", getMemberConfigId())
.append("requiredAmount", getRequiredAmount()) .append("requiredAmount", getRequiredAmount())
.append("validityPeriod", getValidityPeriod()) .append("validityPeriod", getValidityPeriod())
.append("isDelete", getIsDelete()) .append("isDelete", getIsDelete())
......
package share.system.service.impl; package share.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import share.common.utils.DateUtils; import share.common.utils.DateUtils;
import share.system.domain.EquityMembersOrderConfig; import share.system.domain.EquityMembersOrderConfig;
import share.system.domain.MemberConfig;
import share.system.mapper.EquityMembersOrderConfigMapper; import share.system.mapper.EquityMembersOrderConfigMapper;
import share.system.service.EquityMembersOrderConfigService; import share.system.service.EquityMembersOrderConfigService;
import share.system.service.MemberConfigService;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/** /**
* 权益会员订单配置Service业务层处理 * 权益会员订单配置Service业务层处理
...@@ -20,6 +28,8 @@ import java.util.List; ...@@ -20,6 +28,8 @@ import java.util.List;
public class EquityMembersOrderConfigServiceImpl extends ServiceImpl<EquityMembersOrderConfigMapper, EquityMembersOrderConfig> implements EquityMembersOrderConfigService { public class EquityMembersOrderConfigServiceImpl extends ServiceImpl<EquityMembersOrderConfigMapper, EquityMembersOrderConfig> implements EquityMembersOrderConfigService {
@Autowired @Autowired
private EquityMembersOrderConfigMapper equityMembersOrderConfigMapper; private EquityMembersOrderConfigMapper equityMembersOrderConfigMapper;
@Autowired
private MemberConfigService memberConfigService;
/** /**
* 查询权益会员订单配置 * 查询权益会员订单配置
...@@ -51,6 +61,22 @@ public class EquityMembersOrderConfigServiceImpl extends ServiceImpl<EquityMembe ...@@ -51,6 +61,22 @@ public class EquityMembersOrderConfigServiceImpl extends ServiceImpl<EquityMembe
*/ */
@Override @Override
public int insertEquityMembersOrderConfig(EquityMembersOrderConfig equityMembersOrderConfig) { public int insertEquityMembersOrderConfig(EquityMembersOrderConfig equityMembersOrderConfig) {
List<MemberConfig> list = memberConfigService.list(new LambdaQueryWrapper<MemberConfig>()
// .eq(MemberConfig::getMemberType, one.getMemberType())
.orderBy(true, false, MemberConfig::getMembershipLevel));
//转Map limitRequirements,MemberConfig
Map<Long, MemberConfig> memberConfigMap = list.stream().collect(Collectors.toMap(MemberConfig::getMembershipLevel, Function.identity()));
for (Map.Entry<Long, MemberConfig> entry : memberConfigMap.entrySet()) {
if (equityMembersOrderConfig.getGiftPoints().compareTo(BigDecimal.valueOf(entry.getValue().getLimitRequirements())) >= 0 &&
equityMembersOrderConfig.getGiftPoints().compareTo(BigDecimal.valueOf(memberConfigMap.get(entry.getKey() + 1).getLimitRequirements())) < 0
&& entry.getKey().compareTo(Collections.max(memberConfigMap.keySet())) < 0) {
equityMembersOrderConfig.setDefaultLevel(entry.getKey());
break;
} else if (equityMembersOrderConfig.getGiftPoints().compareTo(BigDecimal.valueOf(memberConfigMap.get(Collections.max(memberConfigMap.keySet())).getLimitRequirements())) >= 0) {
equityMembersOrderConfig.setDefaultLevel(Collections.max(memberConfigMap.keySet()));
break;
}
}
equityMembersOrderConfig.setCreateTime(DateUtils.getNowDate()); equityMembersOrderConfig.setCreateTime(DateUtils.getNowDate());
return equityMembersOrderConfigMapper.insertEquityMembersOrderConfig(equityMembersOrderConfig); return equityMembersOrderConfigMapper.insertEquityMembersOrderConfig(equityMembersOrderConfig);
} }
...@@ -63,6 +89,22 @@ public class EquityMembersOrderConfigServiceImpl extends ServiceImpl<EquityMembe ...@@ -63,6 +89,22 @@ public class EquityMembersOrderConfigServiceImpl extends ServiceImpl<EquityMembe
*/ */
@Override @Override
public int updateEquityMembersOrderConfig(EquityMembersOrderConfig equityMembersOrderConfig) { public int updateEquityMembersOrderConfig(EquityMembersOrderConfig equityMembersOrderConfig) {
List<MemberConfig> list = memberConfigService.list(new LambdaQueryWrapper<MemberConfig>()
// .eq(MemberConfig::getMemberType, one.getMemberType())
.orderBy(true, false, MemberConfig::getMembershipLevel));
//转Map limitRequirements,MemberConfig
Map<Long, MemberConfig> memberConfigMap = list.stream().collect(Collectors.toMap(MemberConfig::getMembershipLevel, Function.identity()));
for (Map.Entry<Long, MemberConfig> entry : memberConfigMap.entrySet()) {
if (equityMembersOrderConfig.getGiftPoints().compareTo(BigDecimal.valueOf(entry.getValue().getLimitRequirements())) >= 0 &&
equityMembersOrderConfig.getGiftPoints().compareTo(BigDecimal.valueOf(memberConfigMap.get(entry.getKey() + 1).getLimitRequirements())) < 0
&& entry.getKey().compareTo(Collections.max(memberConfigMap.keySet())) < 0) {
equityMembersOrderConfig.setDefaultLevel(entry.getKey());
break;
} else if (equityMembersOrderConfig.getGiftPoints().compareTo(BigDecimal.valueOf(memberConfigMap.get(Collections.max(memberConfigMap.keySet())).getLimitRequirements())) >= 0) {
equityMembersOrderConfig.setDefaultLevel(Collections.max(memberConfigMap.keySet()));
break;
}
}
equityMembersOrderConfig.setUpdateTime(DateUtils.getNowDate()); equityMembersOrderConfig.setUpdateTime(DateUtils.getNowDate());
return equityMembersOrderConfigMapper.updateEquityMembersOrderConfig(equityMembersOrderConfig); return equityMembersOrderConfigMapper.updateEquityMembersOrderConfig(equityMembersOrderConfig);
} }
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
<result property="id" column="id"/> <result property="id" column="id"/>
<result property="name" column="name"/> <result property="name" column="name"/>
<result property="defaultLevel" column="default_level"/> <result property="defaultLevel" column="default_level"/>
<result property="memberConfigId" column="member_config_id"/>
<result property="requiredAmount" column="required_amount"/> <result property="requiredAmount" column="required_amount"/>
<result property="validityPeriod" column="validity_period"/> <result property="validityPeriod" column="validity_period"/>
<result property="giftPoints" column="gift_points"/> <result property="giftPoints" column="gift_points"/>
...@@ -24,7 +23,6 @@ ...@@ -24,7 +23,6 @@
select id, select id,
name, name,
default_level, default_level,
member_config_id,
required_amount, required_amount,
validity_period, validity_period,
gift_points, gift_points,
...@@ -43,7 +41,6 @@ ...@@ -43,7 +41,6 @@
<where> <where>
<if test="defaultLevel != null ">and default_level = #{defaultLevel}</if> <if test="defaultLevel != null ">and default_level = #{defaultLevel}</if>
<if test="name != null">and name = #{name}</if> <if test="name != null">and name = #{name}</if>
<if test="memberConfigId != null ">and member_config_id = #{memberConfigId}</if>
<if test="requiredAmount != null ">and required_amount = #{requiredAmount}</if> <if test="requiredAmount != null ">and required_amount = #{requiredAmount}</if>
<if test="validityPeriod != null ">and validity_period = #{validityPeriod}</if> <if test="validityPeriod != null ">and validity_period = #{validityPeriod}</if>
<if test="giftPoints != null ">and gift_points = #{giftPoints}</if> <if test="giftPoints != null ">and gift_points = #{giftPoints}</if>
...@@ -62,7 +59,6 @@ ...@@ -62,7 +59,6 @@
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name !=null">name,</if> <if test="name !=null">name,</if>
<if test="defaultLevel != null">default_level,</if> <if test="defaultLevel != null">default_level,</if>
<if test="memberConfigId != null">member_config_id,</if>
<if test="requiredAmount != null">required_amount,</if> <if test="requiredAmount != null">required_amount,</if>
<if test="validityPeriod != null">validity_period,</if> <if test="validityPeriod != null">validity_period,</if>
<if test="giftPoints != null">gift_points,</if> <if test="giftPoints != null">gift_points,</if>
...@@ -76,7 +72,6 @@ ...@@ -76,7 +72,6 @@
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name !=null">#{name},</if> <if test="name !=null">#{name},</if>
<if test="defaultLevel != null">#{defaultLevel},</if> <if test="defaultLevel != null">#{defaultLevel},</if>
<if test="memberConfigId != null">#{memberConfigId},</if>
<if test="requiredAmount != null">#{requiredAmount},</if> <if test="requiredAmount != null">#{requiredAmount},</if>
<if test="validityPeriod != null">#{validityPeriod},</if> <if test="validityPeriod != null">#{validityPeriod},</if>
<if test="giftPoints != null">#{giftPoints},</if> <if test="giftPoints != null">#{giftPoints},</if>
...@@ -94,7 +89,6 @@ ...@@ -94,7 +89,6 @@
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="name !=null">name = #{name},</if> <if test="name !=null">name = #{name},</if>
<if test="defaultLevel != null">default_level = #{defaultLevel},</if> <if test="defaultLevel != null">default_level = #{defaultLevel},</if>
<if test="memberConfigId != null">member_config_id = #{memberConfigId},</if>
<if test="requiredAmount != null">required_amount = #{requiredAmount},</if> <if test="requiredAmount != null">required_amount = #{requiredAmount},</if>
<if test="validityPeriod != null">validity_period = #{validityPeriod},</if> <if test="validityPeriod != null">validity_period = #{validityPeriod},</if>
<if test="giftPoints != null">gift_points = #{giftPoints},</if> <if test="giftPoints != null">gift_points = #{giftPoints},</if>
......
...@@ -43,7 +43,6 @@ ...@@ -43,7 +43,6 @@
<if test="levelName != null and levelName != ''">and level_name like concat('%', #{levelName}, '%')</if> <if test="levelName != null and levelName != ''">and level_name like concat('%', #{levelName}, '%')</if>
<if test="limitRequirements != null ">and limit_requirements = #{limitRequirements}</if> <if test="limitRequirements != null ">and limit_requirements = #{limitRequirements}</if>
<if test="discountRatio != null ">and discount_ratio = #{discountRatio}</if> <if test="discountRatio != null ">and discount_ratio = #{discountRatio}</if>
>
<if test="isDelete != null ">and is_delete = #{isDelete}</if> <if test="isDelete != null ">and is_delete = #{isDelete}</if>
</where> </where>
</select> </select>
......
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