## 加购升级等级校验
This commit is contained in:
parent
d8136f2e85
commit
eccc9cafb9
|
@ -5,6 +5,7 @@ import com.hzs.activity.add.param.AcAddUpgradeListParam;
|
||||||
import com.hzs.activity.add.param.AcAddUpgradeRuleConfigParam;
|
import com.hzs.activity.add.param.AcAddUpgradeRuleConfigParam;
|
||||||
import com.hzs.activity.add.vo.AcAddUpgradeConfig;
|
import com.hzs.activity.add.vo.AcAddUpgradeConfig;
|
||||||
import com.hzs.activity.add.vo.AcAddUpgradeListVO;
|
import com.hzs.activity.add.vo.AcAddUpgradeListVO;
|
||||||
|
import com.hzs.common.domain.system.config.BdGrade;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -25,4 +26,6 @@ public interface AcAddUpgradeConfigMapper extends BaseMapper<AcAddUpgradeConfig>
|
||||||
List<Integer> selectOrderTypeByBaseId(@Param("pkId") Integer pkId);
|
List<Integer> selectOrderTypeByBaseId(@Param("pkId") Integer pkId);
|
||||||
|
|
||||||
List<AcAddUpgradeListVO> queryList(AcAddUpgradeListParam param);
|
List<AcAddUpgradeListVO> queryList(AcAddUpgradeListParam param);
|
||||||
|
|
||||||
|
BdGrade selectGradeValue(@Param("pkId") Integer pkId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.hzs.common.core.enums.EControlType;
|
||||||
import com.hzs.common.core.web.domain.AjaxResult;
|
import com.hzs.common.core.web.domain.AjaxResult;
|
||||||
import com.hzs.common.domain.activity.base.AcBaseConfig;
|
import com.hzs.common.domain.activity.base.AcBaseConfig;
|
||||||
import com.hzs.common.domain.activity.base.AcGoalMemberConfig;
|
import com.hzs.common.domain.activity.base.AcGoalMemberConfig;
|
||||||
|
import com.hzs.common.domain.system.config.BdGrade;
|
||||||
import com.hzs.common.security.utils.SecurityUtils;
|
import com.hzs.common.security.utils.SecurityUtils;
|
||||||
import com.hzs.system.sys.dto.LoginUser;
|
import com.hzs.system.sys.dto.LoginUser;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -149,11 +150,15 @@ public class AcAddUpgradeConfigServiceImpl extends ServiceImpl<AcAddUpgradeConfi
|
||||||
List<AcAddUpgradeRuleConfigParam> acAddUpgradeRuleConfigParams = item.getAcAddUpgradeRuleConfigParams();
|
List<AcAddUpgradeRuleConfigParam> acAddUpgradeRuleConfigParams = item.getAcAddUpgradeRuleConfigParams();
|
||||||
if (acAddUpgradeRuleConfigParams != null) {
|
if (acAddUpgradeRuleConfigParams != null) {
|
||||||
acAddUpgradeRuleConfigParams.forEach(ac -> {
|
acAddUpgradeRuleConfigParams.forEach(ac -> {
|
||||||
|
// 获取升级后等级值
|
||||||
|
BdGrade UpGrade = baseMapper.selectGradeValue(ac.getUpgradeLevel());
|
||||||
|
// 获取升级前等级值
|
||||||
|
BdGrade OriginalGrade = baseMapper.selectGradeValue(ac.getOriginalLevel());
|
||||||
// 校验升级等级是否小于原等级
|
// 校验升级等级是否小于原等级
|
||||||
if (ac.getUpgradeLevel() < ac.getOriginalLevel()) {
|
if (UpGrade.getGradeValue() < OriginalGrade.getGradeValue()) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
String.format("原等级 [%d] 大于升级等级 [%d],不允许插入!",
|
String.format("原等级 [%s] 大于升级等级 [%s],不允许插入!",
|
||||||
ac.getOriginalLevel(), ac.getUpgradeLevel())
|
OriginalGrade.getGradeName(), UpGrade.getGradeName())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
AcAddUpgradeConfig build = AcAddUpgradeConfig.builder()
|
AcAddUpgradeConfig build = AcAddUpgradeConfig.builder()
|
||||||
|
|
|
@ -88,5 +88,8 @@
|
||||||
AND abc.ACT_END_DATE <= TO_DATE(SUBSTR(#{endActEndDate},1,10), 'YYYY-MM-DD')
|
AND abc.ACT_END_DATE <= TO_DATE(SUBSTR(#{endActEndDate},1,10), 'YYYY-MM-DD')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectGradeValue" resultType="com.hzs.common.domain.system.config.BdGrade">
|
||||||
|
SELECT * FROM BD_GRADE WHERE PK_ID = #{pkId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue