Commit 01f41691 authored by wux's avatar wux

Revert "fix:手动更新会员等级信息后,等级记录中匹配规则不对。"

This reverts commit cd1173d7.
parent 4984806c
......@@ -50,42 +50,33 @@ public class MemberUserLevelDetailsController {
@ApiOperation("更新等级详情")
public CommonResult<Boolean> update(@Valid @RequestBody MemberUserLevelDetailsQueryVO reqVO) {
MemberUserLevelDetailsDO memberUserLevelDetailsDO;
if (reqVO.getId() != null){
memberUserLevelDetailsDO = memberUserLevelDetailsService.getById(reqVO.getId());
Long id = reqVO.getId();
MemberUserLevelDetailsDO memberUserLevelDetailsDO = memberUserLevelDetailsService.getById(id);
if (memberUserLevelDetailsDO == null) {
return error(ErrorCodeConstants.LEVEL_DETAILs_NOT_EXISTS);
}
}else {
memberUserLevelDetailsDO = new MemberUserLevelDetailsDO();
}
MemberUserLevelConfigDO configDO;
String levelConfigName="";
if (memberUserLevelDetailsDO.getConfigId()!=null){
configDO = memberUserLevelConfigMapper.selectById(memberUserLevelDetailsDO.getConfigId());
if (configDO == null) {
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);
}
if(!configDO.getLevel().equals(reqVO.getLevel())){
memberUserLevelDetailsDO.setConfigId(null);
}else {
levelConfigName=configDO.getName();
}
}
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.saveOrUpdate(memberUserLevelDetailsDO);
memberUserLevelDetailsService.updateById(memberUserLevelDetailsDO);
//添加操作日志
MemberUserLevelOperateLogDO memberUserLevelOperateLogDo = MemberUserLevelOperateLogDO.builder()
.configId(memberUserLevelDetailsDO.getConfigId())
.configName(levelConfigName)
.configName(configDO.getName())
.memberId(memberUserLevelDetailsDO.getMemberId())
.operator(loginUser.getNickname())
.remarks(memberUserLevelDetailsDO.getRemarks())
......
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