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

View File

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

View File

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