Commit 01f41691 authored by wux's avatar wux

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

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