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

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

parent 44c56a7b
......@@ -50,28 +50,34 @@ public class MemberUserLevelDetailsController {
@ApiOperation("更新等级详情")
public CommonResult<Boolean> update(@Valid @RequestBody MemberUserLevelDetailsQueryVO reqVO) {
Long id = reqVO.getId();
MemberUserLevelDetailsDO memberUserLevelDetailsDO = memberUserLevelDetailsService.getById(id);
if (memberUserLevelDetailsDO == null) {
return error(ErrorCodeConstants.LEVEL_DETAILs_NOT_EXISTS);
MemberUserLevelDetailsDO memberUserLevelDetailsDO;
if (reqVO.getId() != null){
memberUserLevelDetailsDO = memberUserLevelDetailsService.getById(reqVO.getId());
if (memberUserLevelDetailsDO == null) {
return error(ErrorCodeConstants.LEVEL_DETAILs_NOT_EXISTS);
}
}else {
memberUserLevelDetailsDO = new MemberUserLevelDetailsDO();
}
LambdaQueryWrapper<MemberUserLevelConfigDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MemberUserLevelConfigDO::getLevel, reqVO.getLevel());
// 执行查询
MemberUserLevelConfigDO configDO = memberUserLevelConfigMapper.selectOne(wrapper);
if (configDO==null){
return error(ErrorCodeConstants.LEVEL_RULE_NOT_EXISTS);
MemberUserLevelConfigDO configDO = new MemberUserLevelConfigDO();
if (memberUserLevelDetailsDO.getConfigId()!=null){
configDO = memberUserLevelConfigMapper.selectById(memberUserLevelDetailsDO.getConfigId());
if (configDO == null) {
return error(ErrorCodeConstants.LEVEL_RULE_NOT_EXISTS);
}
if(configDO.getLevel().equals(reqVO.getLevel())){
memberUserLevelDetailsDO.setConfigId(null);
}
}
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
memberUserLevelDetailsDO.setLevel(reqVO.getLevel());
memberUserLevelDetailsDO.setMemberId(reqVO.getMemberId());
memberUserLevelDetailsDO.setValidityPeriod(reqVO.getValidityPeriod());
memberUserLevelDetailsDO.setSpecificSettings(reqVO.getSpecificSettings());
memberUserLevelDetailsDO.setRemarks(reqVO.getRemarks());
memberUserLevelDetailsDO.setConfigId(configDO.getId());
memberUserLevelDetailsDO.setUpdateTime(new Date());
memberUserLevelDetailsDO.setUpdater(String.valueOf(loginUser.getId()));
memberUserLevelDetailsService.updateById(memberUserLevelDetailsDO);
memberUserLevelDetailsService.saveOrUpdate(memberUserLevelDetailsDO);
//添加操作日志
MemberUserLevelOperateLogDO memberUserLevelOperateLogDo = MemberUserLevelOperateLogDO.builder()
......
......@@ -1058,7 +1058,9 @@ currency.not.exist = currency not exist
date.format.error = date format error, for example : 2024-01-01 12:11:11
redeem.cancel.status.error = record status must be redeeming
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.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
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.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.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