Commit 41c191d3 authored by Smile's avatar Smile Committed by wux

会员等级修改,1.定时任务从高等级往下匹配,2.可手动设置等级

parent 44c56a7b
...@@ -50,28 +50,34 @@ public class MemberUserLevelDetailsController { ...@@ -50,28 +50,34 @@ public class MemberUserLevelDetailsController {
@ApiOperation("更新等级详情") @ApiOperation("更新等级详情")
public CommonResult<Boolean> update(@Valid @RequestBody MemberUserLevelDetailsQueryVO reqVO) { public CommonResult<Boolean> update(@Valid @RequestBody MemberUserLevelDetailsQueryVO reqVO) {
Long id = reqVO.getId(); MemberUserLevelDetailsDO memberUserLevelDetailsDO;
if (reqVO.getId() != null){
MemberUserLevelDetailsDO memberUserLevelDetailsDO = memberUserLevelDetailsService.getById(id); memberUserLevelDetailsDO = memberUserLevelDetailsService.getById(reqVO.getId());
if (memberUserLevelDetailsDO == null) { if (memberUserLevelDetailsDO == null) {
return error(ErrorCodeConstants.LEVEL_DETAILs_NOT_EXISTS); return error(ErrorCodeConstants.LEVEL_DETAILs_NOT_EXISTS);
}
}else {
memberUserLevelDetailsDO = new MemberUserLevelDetailsDO();
} }
LambdaQueryWrapper<MemberUserLevelConfigDO> wrapper = new LambdaQueryWrapper<>(); MemberUserLevelConfigDO configDO = new MemberUserLevelConfigDO();
wrapper.eq(MemberUserLevelConfigDO::getLevel, reqVO.getLevel()); if (memberUserLevelDetailsDO.getConfigId()!=null){
// 执行查询 configDO = memberUserLevelConfigMapper.selectById(memberUserLevelDetailsDO.getConfigId());
MemberUserLevelConfigDO configDO = memberUserLevelConfigMapper.selectOne(wrapper); if (configDO == null) {
if (configDO==null){ return error(ErrorCodeConstants.LEVEL_RULE_NOT_EXISTS);
return error(ErrorCodeConstants.LEVEL_RULE_NOT_EXISTS); }
if(configDO.getLevel().equals(reqVO.getLevel())){
memberUserLevelDetailsDO.setConfigId(null);
}
} }
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
memberUserLevelDetailsDO.setLevel(reqVO.getLevel()); memberUserLevelDetailsDO.setLevel(reqVO.getLevel());
memberUserLevelDetailsDO.setMemberId(reqVO.getMemberId());
memberUserLevelDetailsDO.setValidityPeriod(reqVO.getValidityPeriod()); memberUserLevelDetailsDO.setValidityPeriod(reqVO.getValidityPeriod());
memberUserLevelDetailsDO.setSpecificSettings(reqVO.getSpecificSettings()); memberUserLevelDetailsDO.setSpecificSettings(reqVO.getSpecificSettings());
memberUserLevelDetailsDO.setRemarks(reqVO.getRemarks()); memberUserLevelDetailsDO.setRemarks(reqVO.getRemarks());
memberUserLevelDetailsDO.setConfigId(configDO.getId());
memberUserLevelDetailsDO.setUpdateTime(new Date()); memberUserLevelDetailsDO.setUpdateTime(new Date());
memberUserLevelDetailsDO.setUpdater(String.valueOf(loginUser.getId())); memberUserLevelDetailsDO.setUpdater(String.valueOf(loginUser.getId()));
memberUserLevelDetailsService.updateById(memberUserLevelDetailsDO); memberUserLevelDetailsService.saveOrUpdate(memberUserLevelDetailsDO);
//添加操作日志 //添加操作日志
MemberUserLevelOperateLogDO memberUserLevelOperateLogDo = MemberUserLevelOperateLogDO.builder() MemberUserLevelOperateLogDO memberUserLevelOperateLogDo = MemberUserLevelOperateLogDO.builder()
......
...@@ -1058,7 +1058,9 @@ currency.not.exist = currency not exist ...@@ -1058,7 +1058,9 @@ currency.not.exist = currency not exist
date.format.error = date format error, for example : 2024-01-01 12:11:11 date.format.error = date format error, for example : 2024-01-01 12:11:11
redeem.cancel.status.error = record status must be redeeming redeem.cancel.status.error = record status must be redeeming
level.bound.range.error = upper count must greater than lower count level.bound.range.error = upper count must greater than lower count
level.bound.range.conflict = score range exist conflict level.bound.range.conflict = score range exist conflict'
level.rule.not.exists = Membership level rule does not exist
level.details.not.exists = Membership level details do not exist
score.operate.idempotent.error = idempotent key conflict score.operate.idempotent.error = idempotent key conflict
score.rule.not.exists = score rule not exists score.rule.not.exists = score rule not exists
......
...@@ -1057,6 +1057,8 @@ date.format.error=Format de date incorrect, format correct : 2024-01-01 12:11:11 ...@@ -1057,6 +1057,8 @@ date.format.error=Format de date incorrect, format correct : 2024-01-01 12:11:11
redeem.cancel.status.error=Seules les enregistrements avec un statut "en \u00E9change" peuvent \u00EAtre annul\u00E9s redeem.cancel.status.error=Seules les enregistrements avec un statut "en \u00E9change" peuvent \u00EAtre annul\u00E9s
level.bound.range.error=La valeur sup\u00E9rieure doit \u00EAtre sup\u00E9rieure \u00E0 la valeur inf\u00E9rieure level.bound.range.error=La valeur sup\u00E9rieure doit \u00EAtre sup\u00E9rieure \u00E0 la valeur inf\u00E9rieure
level.bound.range.conflict=Conflit dans la plage des points de fid\u00E9lit\u00E9 level.bound.range.conflict=Conflit dans la plage des points de fid\u00E9lit\u00E9
level.rule.not.exists = La r\u00E8gle du niveau de membre n'existe pas
level.details.not.exists = Les d\u00E9tails du niveau de membre n'existent pas
score.operate.idempotent.error=Conflit de cl\u00E9 idempotente score.operate.idempotent.error=Conflit de cl\u00E9 idempotente
score.rule.not.exists=La r\u00E8gle de points n'existe pas score.rule.not.exists=La r\u00E8gle de points n'existe pas
......
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