fix(core):单号生成规则没有清除缓存

yun-zuoyi
汪云昊 4 years ago
parent fe018a28bb
commit 11e6487225

@ -122,6 +122,10 @@ public class SysOrderNoRuleController extends CoreBaseController {
.checkNotZero("isCycle", sysOrderNoRule.getIsCycle());
sysOrderNoRuleService.updateSysOrderNoRule(sysOrderNoRule);
// 清理缓存
redisRes.deleteKey(REDIS_PREFIX_LOCK_GET_ORDER_NO + ":" + sysOrderNoRule.getOrderNoRuleCode());
return ResultBean.success("操作成功").setResultObject(sysOrderNoRule).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);
@ -157,11 +161,11 @@ public class SysOrderNoRuleController extends CoreBaseController {
SysOrderNoRule sysOrderNoRule = sysOrderNoRuleService.getSysOrderNoRuleById(Long.parseLong(idStr));
ValidatorBean.checkNotNull(sysOrderNoRule,"单号规则不存在");
// 清理缓存
redisRes.deleteKey(REDIS_PREFIX_LOCK_GET_ORDER_NO + ":" + sysOrderNoRule.getOrderNoRuleCode());
// 删除
sysOrderNoRuleService.deleteSysOrderNoRuleById(sysOrderNoRule.getId());
// 清理缓存
redisRes.deleteKey(REDIS_PREFIX_LOCK_GET_ORDER_NO + ":" + sysOrderNoRule.getOrderNoRuleCode());
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);

@ -87,10 +87,11 @@ public class SynchronizedService implements ISynchronizedService {
sysOrderNoRuleService.detachSysOrderNoRule(codeRole);
Long incr = codeRole.getSerialNoIncrement() * num;
long orginSerialNo = codeRole.getSerialNo() < 0 ? 0 : codeRole.getSerialNo();
long incr = codeRole.getSerialNoIncrement() * num;
//缓存增加
//先判断redis是否存在如果不存在则用默认初始值+步长*数量,如果存在,则添加步长 * 数量
codeRole.setSerialNo(redisRes.putObjAdditational(redisKey, codeRole.getSerialNo(), incr)-incr);
codeRole.setSerialNo(redisRes.putObjAdditional(redisKey, orginSerialNo, incr) - incr);
// 生成单号更缓存
List<SysOrderNoRule> orderNoRuleList = sysOrderNoRuleService.doGetSysOrderNoRuleByNum(codeRole, num);

Loading…
Cancel
Save