opt:newcode,redisson锁报错
This commit is contained in:
@@ -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("系统繁忙,稍后在试!");
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class RedissonUtils {
|
||||
if (isLock){
|
||||
process.apply(param);
|
||||
} else {
|
||||
return;
|
||||
throw new BadRequestException("当前业务正在操作,稍后再试");
|
||||
}
|
||||
}catch (Exception ex){
|
||||
throw ex;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user