From 7060ccc1ef9cadf645dc9b3b982b4229fe8bb2d5 Mon Sep 17 00:00:00 2001 From: ludj Date: Tue, 14 Feb 2023 19:39:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nladmin-system/nlsso-server/pom.xml | 12 ++- .../src/main/java/org/nl/AppRun.java | 3 +- .../param/impl/SysParamServiceImpl.java | 102 +++++++++--------- 3 files changed, 62 insertions(+), 55 deletions(-) diff --git a/nladmin-system/nlsso-server/pom.xml b/nladmin-system/nlsso-server/pom.xml index acdf66d..95e778b 100644 --- a/nladmin-system/nlsso-server/pom.xml +++ b/nladmin-system/nlsso-server/pom.xml @@ -27,7 +27,7 @@ 5.7.14 0.11.1 - 5.9.0 + 5.8.0 1.9 4.1.59.Final @@ -380,6 +380,14 @@ 1.9.2 + + + + org.springframework.retry + spring-retry + + + org.springframework.boot @@ -472,7 +480,7 @@ com.github.oshi oshi-core - 5.0.1 + 6.1.4 diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java b/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java index 09fd9fa..16d6438 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/AppRun.java @@ -11,7 +11,7 @@ import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactor import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.server.ServletWebServerFactory; import org.springframework.context.annotation.Bean; -import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories; +import org.springframework.retry.annotation.EnableRetry; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.web.bind.annotation.RestController; @@ -35,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController; @EnableMethodCache(basePackages = "org.nl") @EnableCreateCacheAnnotation @MapperScan("org.nl.**.mapper") +@EnableRetry //https://juejin.cn/post/7094613787973517343 public class AppRun { public static void main(String[] args) { diff --git a/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java b/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java index cefd376..a163d8f 100644 --- a/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java +++ b/nladmin-system/nlsso-server/src/main/java/org/nl/system/service/param/impl/SysParamServiceImpl.java @@ -12,7 +12,7 @@ import org.nl.common.aspect.exception.BadRequestException; import org.nl.common.domain.query.PageQuery; import org.nl.common.utils.MapOf; import org.nl.common.utils.SecurityUtils; - import org.nl.system.service.param.ISysParamService; +import org.nl.system.service.param.ISysParamService; import org.nl.system.service.param.dao.Param; import org.nl.system.service.param.dao.mapper.SysParamMapper; import org.springframework.stereotype.Service; @@ -22,9 +22,7 @@ import java.util.List; import java.util.Map; /** - *

* 系统参数表 服务实现类 - *

* * @author generator * @since 2022-12-14 @@ -33,59 +31,59 @@ import java.util.Map; @RequiredArgsConstructor @Slf4j @Transactional -public class SysParamServiceImpl extends ServiceImpl implements ISysParamService { +public class SysParamServiceImpl extends ServiceImpl + implements ISysParamService { - private final SysParamMapper paramMapper; + private final SysParamMapper paramMapper; - @Override - public Page queryPage(Map whereJson, PageQuery page) { - log.info("111"); - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.orderBy(true, true, "create_time"); - Page paramPage = paramMapper.selectPage(page.build(), queryWrapper); - return paramPage; - } + @Override + public Page queryPage(Map whereJson, PageQuery page) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderBy(true, true, "create_time"); + Page paramPage = paramMapper.selectPage(page.build(), queryWrapper); + return paramPage; + } - @Override - @Transactional(rollbackFor = Exception.class) - public void create(Param param) { - List code = paramMapper.selectByMap(MapOf.of("code", param.getCode())); - if (ObjectUtil.isNotEmpty(code)) throw new BadRequestException("编码不能一致"); - param.setId(IdUtil.getSnowflake(1, 1).nextIdStr()); - String currentUserId = SecurityUtils.getCurrentUserId(); - String nickName = SecurityUtils.getCurrentNickName(); - String now = DateUtil.now(); - param.setCreateId(currentUserId); - param.setCreateName(nickName); - param.setCreateTime(now); - param.setUpdateId(currentUserId); - param.setUpdateName(nickName); - param.setUpdateTime(now); - paramMapper.insert(param); - } + @Override + @Transactional(rollbackFor = Exception.class) + public void create(Param param) { + List code = paramMapper.selectByMap(MapOf.of("code", param.getCode())); + if (ObjectUtil.isNotEmpty(code)) throw new BadRequestException("编码不能一致"); + param.setId(IdUtil.getSnowflake(1, 1).nextIdStr()); + String currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getCurrentNickName(); + String now = DateUtil.now(); + param.setCreateId(currentUserId); + param.setCreateName(nickName); + param.setCreateTime(now); + param.setUpdateId(currentUserId); + param.setUpdateName(nickName); + param.setUpdateTime(now); + paramMapper.insert(param); + } - @Override - @Transactional(rollbackFor = Exception.class) - public void update(Param param) { - Param paramObj = paramMapper.selectById(param.getId()); - if (ObjectUtil.isEmpty(paramObj)) throw new BadRequestException("被删除或无权限,操作失败!"); - param.setUpdateId(SecurityUtils.getCurrentUserId()); - param.setUpdateName(SecurityUtils.getCurrentNickName()); - param.setUpdateTime(DateUtil.now()); - paramMapper.updateById(param); - } + @Override + @Transactional(rollbackFor = Exception.class) + public void update(Param param) { + Param paramObj = paramMapper.selectById(param.getId()); + if (ObjectUtil.isEmpty(paramObj)) throw new BadRequestException("被删除或无权限,操作失败!"); + param.setUpdateId(SecurityUtils.getCurrentUserId()); + param.setUpdateName(SecurityUtils.getCurrentNickName()); + param.setUpdateTime(DateUtil.now()); + paramMapper.updateById(param); + } - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteByIds(List ids) { - paramMapper.deleteBatchIds(ids); - } + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteByIds(List ids) { + paramMapper.deleteBatchIds(ids); + } - @Override - public Param findByCode(String code) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("code", code); - Param param = paramMapper.selectOne(queryWrapper); - return param; - } + @Override + public Param findByCode(String code) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("code", code); + Param param = paramMapper.selectOne(queryWrapper); + return param; + } }