Skip to content

Commit

Permalink
v3.12【新增】标签页Chome模式;【优化】优化很多细节
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuoda committed Jan 8, 2025
1 parent 56517b6 commit 96d498f
Show file tree
Hide file tree
Showing 77 changed files with 2,713 additions and 910 deletions.
35 changes: 0 additions & 35 deletions smart-admin-api-java17-springboot3/.gitignore

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ public ResponseDTO<PageResult<SmartJobVO>> queryJob(@RequestBody @Valid SmartJob
return jobService.queryJob(queryForm);
}

@Operation(summary = "定时任务-添加任务 @huke")
@PostMapping("/job/add")
@RepeatSubmit
public ResponseDTO<String> addJob(@RequestBody @Valid SmartJobAddForm addForm) {
RequestUser requestUser = SmartRequestUtil.getRequestUser();
addForm.setUpdateName(requestUser.getUserName());
return jobService.addJob(addForm);
}

@Operation(summary = "定时任务-更新-任务信息 @huke")
@PostMapping("/job/update")
@RepeatSubmit
Expand All @@ -70,6 +79,13 @@ public ResponseDTO<String> updateJobEnabled(@RequestBody @Valid SmartJobEnabledU
return jobService.updateJobEnabled(updateForm);
}

@Operation(summary = "定时任务-删除 @zhuoda")
@GetMapping("/job/delete")
@RepeatSubmit
public ResponseDTO<String> deleteJob(@RequestParam Integer jobId) {
return jobService.deleteJob(jobId, SmartRequestUtil.getRequestUser());
}

@Operation(summary = "定时任务-执行记录-分页查询 @huke")
@PostMapping("/job/log/query")
public ResponseDTO<PageResult<SmartJobLogVO>> queryJobLog(@RequestBody @Valid SmartJobLogQueryForm queryForm) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.base.common.domain.DataScopePlugin;
import net.lab1024.sa.base.handler.MybatisPlusFillHandler;
Expand All @@ -25,6 +24,7 @@
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

import javax.sql.DataSource;
Expand Down Expand Up @@ -92,10 +92,10 @@ public class DataSourceConfig {
@Value("${spring.datasource.druid.method.pointcut}")
String methodPointcut;

@Resource
@jakarta.annotation.Resource
private MybatisPlusInterceptor paginationInterceptor;

@Resource
@jakarta.annotation.Resource
private DataScopePlugin dataScopePlugin;

@Bean
Expand Down Expand Up @@ -136,7 +136,7 @@ public SqlSessionFactory sqlSessionFactory() throws Exception {
MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
factoryBean.setDataSource(druidDataSource());
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
org.springframework.core.io.Resource[] resources = resolver.getResources("classpath*:/mapper/**/*.xml");
Resource[] resources = resolver.getResources("classpath*:/mapper/**/*.xml");
factoryBean.setMapperLocations(resources);

// 设置 MyBatis-Plus 分页插件 注意此处myBatisPlugin一定要放在后面
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.time.format.DateTimeParseException;

/**
* Json 序列化配置
* json 序列化配置
*
* @Author 1024创新实验室-主任: 卓大
* @Date 2017-11-28 15:21:10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,19 @@ public class RedisConfig {

@Bean
public RedisTemplate<String, Object> redisTemplate() {

Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<Object>(Object.class);
ObjectMapper om = new ObjectMapper();
om.registerModule(new JavaTimeModule())
.configure(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false)
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS, false)
.setSerializationInclusion(JsonInclude.Include.NON_NULL);
Jackson2JsonRedisSerializer<Object> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(om, Object.class);

om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
// enableDefaultTyping 官方已弃用 所以改为 activateDefaultTyping
om.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL);
jackson2JsonRedisSerializer.setObjectMapper(om);
RedisTemplate<String, Object> template = new RedisTemplate<>();
template.setConnectionFactory(factory);
template.setKeySerializer(new StringRedisSerializer());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package net.lab1024.sa.base.config;

import cn.dev33.satoken.config.SaTokenConfig;
import jakarta.annotation.Resource;
import net.lab1024.sa.base.module.support.securityprotect.service.Level3ProtectConfigService;
import org.springframework.context.annotation.Configuration;

/**
*
* 三级等保配置初始化后最低活跃频率全局配置
*
* @Author 1024创新实验室-创始人兼主任:卓大
* @Date 2024/11/24
* @Wechat zhuoda1024
* @Email [email protected]
* @Copyright <a href="https://1024lab.net">1024创新实验室</a> ,Since 2012
*/

@Configuration
public class TokenConfig {

@Resource
private Level3ProtectConfigService level3ProtectConfigService;

// 此配置会覆盖 sa-base.yaml 中的配置
@Resource
public void configSaToken(SaTokenConfig config) {

config.setActiveTimeout(level3ProtectConfigService.getLoginActiveTimeoutSeconds());
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.condition.PathPatternsRequestCondition;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

Expand Down Expand Up @@ -47,11 +48,12 @@ public Map<Method, Set<String>> methodUrlMap() {
Map<RequestMappingInfo, HandlerMethod> map = requestMappingHandlerMapping.getHandlerMethods();
for (Map.Entry<RequestMappingInfo, HandlerMethod> entry : map.entrySet()) {
RequestMappingInfo requestMappingInfo = entry.getKey();
if(requestMappingInfo.getPatternsCondition() == null){
PathPatternsRequestCondition pathPatternsCondition = requestMappingInfo.getPathPatternsCondition();
if(pathPatternsCondition == null){
continue;
}

Set<String> urls = requestMappingInfo.getPatternsCondition().getPatterns();
Set<String> urls = pathPatternsCondition.getPatternValues();
if (CollectionUtils.isEmpty(urls)) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ public class CaptchaService {

@Resource
private DefaultKaptcha defaultKaptcha;
@Autowired

@Resource
private SystemEnvironment systemEnvironment;

@Resource
private RedisService redisService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @Date 2022/9/29 17:20:41
* @Wechat zhuoda1024
* @Email [email protected]
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/

public class EntityVariableService extends CodeGenerateBaseVariableService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @Date 2022/5/26 19:40:55
* @Wechat zhuoda1024
* @Email [email protected]
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Service
public class DictService {
Expand All @@ -39,10 +39,6 @@ public class DictService {
private DictValueDao dictValueDao;
@Resource
private DictCacheService dictCacheService;
/**
* CODE锁
*/
private static final Interner<String> CODE_POOL = Interners.newWeakInterner();


/**
Expand All @@ -51,15 +47,15 @@ public class DictService {
* @param keyAddForm
* @return
*/
public ResponseDTO<String> keyAdd(DictKeyAddForm keyAddForm) {
synchronized (CODE_POOL.intern(keyAddForm.getKeyCode())) {
DictKeyEntity dictKeyEntity = dictKeyDao.selectByCode(keyAddForm.getKeyCode(), false);
if (dictKeyEntity != null) {
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
}
dictKeyEntity = SmartBeanUtil.copy(keyAddForm, DictKeyEntity.class);
dictKeyDao.insert(dictKeyEntity);
public synchronized ResponseDTO<String> keyAdd(DictKeyAddForm keyAddForm) {
DictKeyEntity dictKeyEntity = dictKeyDao.selectByCode(keyAddForm.getKeyCode(), false);
if (dictKeyEntity != null) {
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
}
dictKeyEntity = SmartBeanUtil.copy(keyAddForm, DictKeyEntity.class);
dictKeyDao.insert(dictKeyEntity);
//刷新缓存
dictCacheService.cacheRefresh();
return ResponseDTO.ok();
}

Expand All @@ -69,15 +65,15 @@ public ResponseDTO<String> keyAdd(DictKeyAddForm keyAddForm) {
* @param valueAddForm
* @return
*/
public ResponseDTO<String> valueAdd(DictValueAddForm valueAddForm) {
synchronized (CODE_POOL.intern(valueAddForm.getValueCode())) {
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueAddForm.getValueCode(), false);
if (dictValueEntity != null) {
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
}
dictValueEntity = SmartBeanUtil.copy(valueAddForm, DictValueEntity.class);
dictValueDao.insert(dictValueEntity);
public synchronized ResponseDTO<String> valueAdd(DictValueAddForm valueAddForm) {
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueAddForm.getValueCode(), false);
if (dictValueEntity != null) {
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
}
dictValueEntity = SmartBeanUtil.copy(valueAddForm, DictValueEntity.class);
dictValueDao.insert(dictValueEntity);
//刷新缓存
dictCacheService.cacheRefresh();
return ResponseDTO.ok();
}

Expand All @@ -87,15 +83,15 @@ public ResponseDTO<String> valueAdd(DictValueAddForm valueAddForm) {
* @param keyUpdateForm
* @return
*/
public ResponseDTO<String> keyEdit(DictKeyUpdateForm keyUpdateForm) {
synchronized (CODE_POOL.intern(keyUpdateForm.getKeyCode())) {
DictKeyEntity dictKeyEntity = dictKeyDao.selectByCode(keyUpdateForm.getKeyCode(), false);
if (dictKeyEntity != null && !dictKeyEntity.getDictKeyId().equals(keyUpdateForm.getDictKeyId())) {
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
}
DictKeyEntity dictKeyUpdateEntity = SmartBeanUtil.copy(keyUpdateForm, DictKeyEntity.class);
dictKeyDao.updateById(dictKeyUpdateEntity);
public synchronized ResponseDTO<String> keyEdit(DictKeyUpdateForm keyUpdateForm) {
DictKeyEntity dictKeyEntity = dictKeyDao.selectByCode(keyUpdateForm.getKeyCode(), false);
if (dictKeyEntity != null && !dictKeyEntity.getDictKeyId().equals(keyUpdateForm.getDictKeyId())) {
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
}
DictKeyEntity dictKeyUpdateEntity = SmartBeanUtil.copy(keyUpdateForm, DictKeyEntity.class);
dictKeyDao.updateById(dictKeyUpdateEntity);
//刷新缓存
dictCacheService.cacheRefresh();
return ResponseDTO.ok();
}

Expand All @@ -105,19 +101,19 @@ public ResponseDTO<String> keyEdit(DictKeyUpdateForm keyUpdateForm) {
* @param valueUpdateForm
* @return
*/
public ResponseDTO<String> valueEdit(DictValueUpdateForm valueUpdateForm) {
public synchronized ResponseDTO<String> valueEdit(DictValueUpdateForm valueUpdateForm) {
DictKeyEntity dictKeyEntity = dictKeyDao.selectById(valueUpdateForm.getDictKeyId());
if (dictKeyEntity == null || dictKeyEntity.getDeletedFlag()) {
return ResponseDTO.userErrorParam("key不能存在");
}
synchronized (CODE_POOL.intern(valueUpdateForm.getValueCode())) {
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueUpdateForm.getValueCode(), false);
if (dictValueEntity != null && !dictValueEntity.getDictValueId().equals(valueUpdateForm.getDictValueId())) {
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
}
DictValueEntity dictValueUpdateEntity = SmartBeanUtil.copy(valueUpdateForm, DictValueEntity.class);
dictValueDao.updateById(dictValueUpdateEntity);
DictValueEntity dictValueEntity = dictValueDao.selectByCode(valueUpdateForm.getValueCode(), false);
if (dictValueEntity != null && !dictValueEntity.getDictValueId().equals(valueUpdateForm.getDictValueId())) {
return ResponseDTO.error(UserErrorCode.ALREADY_EXIST);
}
DictValueEntity dictValueUpdateEntity = SmartBeanUtil.copy(valueUpdateForm, DictValueEntity.class);
dictValueDao.updateById(dictValueUpdateEntity);
//刷新缓存
dictCacheService.cacheRefresh();
return ResponseDTO.ok();
}

Expand All @@ -127,11 +123,13 @@ public ResponseDTO<String> valueEdit(DictValueUpdateForm valueUpdateForm) {
* @param keyIdList
* @return
*/
public ResponseDTO<String> keyDelete(List<Long> keyIdList) {
public synchronized ResponseDTO<String> keyDelete(List<Long> keyIdList) {
if (CollectionUtils.isEmpty(keyIdList)) {
return ResponseDTO.ok();
}
dictKeyDao.updateDeletedFlagByIdList(keyIdList, true);
//刷新缓存
dictCacheService.cacheRefresh();
return ResponseDTO.ok();
}

Expand All @@ -141,11 +139,13 @@ public ResponseDTO<String> keyDelete(List<Long> keyIdList) {
* @param valueIdList
* @return
*/
public ResponseDTO<String> valueDelete(List<Long> valueIdList) {
public synchronized ResponseDTO<String> valueDelete(List<Long> valueIdList) {
if (CollectionUtils.isEmpty(valueIdList)) {
return ResponseDTO.ok();
}
dictValueDao.updateDeletedFlagByIdList(valueIdList, true);
//刷新缓存
dictCacheService.cacheRefresh();
return ResponseDTO.ok();
}

Expand Down
Loading

0 comments on commit 96d498f

Please sign in to comment.