opt:newcode,redisson锁报错

This commit is contained in:
zhangzq
2025-06-30 12:07:20 +08:00
parent db61709c4f
commit 67d5dca6fd
3 changed files with 5 additions and 10 deletions

View File

@@ -28,11 +28,8 @@ public class CodeUtil {
String flag = "1";
HashMap<String, String> map = new HashMap<>();
map.put("flag", flag);
String code = HttpUtil.get("http://127.0.0.1:8011/api/codeDetail/getNewCode?code=" + ruleCode + "&flag=" + flag);
if (code.contains("status")){
throw new BadRequestException(code);
}
return code;
map.put("code", ruleCode);
return SpringContextHolder.getBean(ISysCodeRuleService.class).codeDemo(map);
} else {
throw new BadRequestException("系统繁忙,稍后在试!");
}

View File

@@ -32,7 +32,7 @@ public class RedissonUtils {
if (isLock){
process.apply(param);
} else {
return;
throw new BadRequestException("当前业务正在操作,稍后再试");
}
}catch (Exception ex){
throw ex;

View File

@@ -66,6 +66,7 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
@SneakyThrows
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public String codeDemo(Map form) {
String code = (String) form.get("code");
String id = codeRuleMapper.selectOne(new LambdaQueryWrapper<SysCodeRule>().eq(SysCodeRule::getCode, code)).getId();
@@ -135,10 +136,7 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
}
demo += value;
if ("1".equals(flag)) {
new Thread(()->{
codeRuleDetailMapper.updateById(detail);
})
.start();
codeRuleDetailMapper.updateById(detail);
}
log.info("更新成功:更新数据{}", detail);
}