3 Commits

1399 changed files with 11574 additions and 9406 deletions

View File

@@ -1,9 +1,11 @@
package net.lab1024.sa.admin.module.business.goods.domain.form;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import net.lab1024.sa.admin.module.business.goods.constant.GoodsStatusEnum;
import net.lab1024.sa.base.common.domain.PageParam;
import net.lab1024.sa.base.common.json.deserializer.DictValueVoDeserializer;
import net.lab1024.sa.base.common.swagger.SchemaEnum;
import net.lab1024.sa.base.common.validator.enumeration.CheckEnum;
import org.hibernate.validator.constraints.Length;
@@ -32,6 +34,7 @@ public class GoodsQueryForm extends PageParam {
private Integer goodsStatus;
@Schema(description = "产地")
@JsonDeserialize(using = DictValueVoDeserializer.class)
private String place;
@Schema(description = "上架状态")

View File

@@ -52,7 +52,6 @@ public class NoticeEmployeeService {
public ResponseDTO<PageResult<NoticeEmployeeVO>> queryList(Long requestEmployeeId, NoticeEmployeeQueryForm noticeEmployeeQueryForm) {
Page<?> page = SmartPageUtil.convert2PageQuery(noticeEmployeeQueryForm);
//获取请求人的 部门及其子部门
List<Long> employeeDepartmentIdList = Lists.newArrayList();
EmployeeEntity employeeEntity = employeeService.getById(requestEmployeeId);
// 如果不是管理员 则获取请求人的 部门及其子部门

View File

@@ -25,7 +25,7 @@ import java.util.List;
* @Date 2021-12-09 22:57:49
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@RestController
@Tag(name = AdminSwaggerTagConst.System.SYSTEM_EMPLOYEE)
@@ -110,7 +110,7 @@ public class EmployeeController {
@Operation(summary = "重置员工密码 @author 卓大")
@GetMapping("/employee/update/password/reset/{employeeId}")
@SaCheckPermission("system:employee:password:reset")
public ResponseDTO<String> resetPassword(@PathVariable Integer employeeId) {
public ResponseDTO<String> resetPassword(@PathVariable Long employeeId) {
return employeeService.resetPassword(employeeId);
}

View File

@@ -113,6 +113,6 @@ public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
/**
* 员工重置密码
*/
Integer updatePassword(@Param("employeeId") Integer employeeId, @Param("password") String password);
Integer updatePassword(@Param("employeeId") Long employeeId, @Param("password") String password);
}

View File

@@ -47,8 +47,6 @@ import java.util.stream.Collectors;
@Service
public class EmployeeService {
private static final String PASSWORD_SALT_FORMAT = "smart_%s_admin_$^&*";
@Resource
private EmployeeDao employeeDao;
@@ -364,7 +362,7 @@ public class EmployeeService {
/**
* 重置密码
*/
public ResponseDTO<String> resetPassword(Integer employeeId) {
public ResponseDTO<String> resetPassword(Long employeeId) {
String password = securityPasswordService.randomPassword();
employeeDao.updatePassword(employeeId, SecurityPasswordService.getEncryptPwd(password));
return ResponseDTO.ok(password);

View File

@@ -16,7 +16,7 @@ import java.util.List;
* @Date 2022-04-08 21:53:04
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Service
public class RoleEmployeeManager extends ServiceImpl<RoleEmployeeDao, RoleEmployeeEntity> {

View File

@@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.RestController;
* @Date 2023/10/17 19:07:27
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>Since 2012
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>Since 2012
*/
@RestController

View File

@@ -95,25 +95,25 @@
left join t_notice_type on t_notice.notice_type_id = t_notice_type.notice_type_id
<where>
<if test="!administratorFlag">
(
(
t_notice.notice_id in
(select t_notice_visible_range.notice_id
from t_notice_visible_range
where
( t_notice_visible_range.data_type = #{departmentDataType}
<if test="requestEmployeeDepartmentIdList != null and requestEmployeeDepartmentIdList.size > 0">
and
t_notice_visible_range.data_id
in
<foreach collection="requestEmployeeDepartmentIdList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
)
or ( t_notice_visible_range.data_type = #{employeeDataType} and t_notice_visible_range.data_id = #{requestEmployeeId} )
<if test="requestEmployeeDepartmentIdList != null and requestEmployeeDepartmentIdList.size > 0">
and
t_notice_visible_range.data_id
in
<foreach collection="requestEmployeeDepartmentIdList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
)
or ( t_notice_visible_range.data_type = #{employeeDataType} and t_notice_visible_range.data_id = #{requestEmployeeId} )
)
or t_notice.all_visible_flag = true
)
)
</if>
and t_notice.deleted_flag = #{deletedFlag}

View File

@@ -8,7 +8,7 @@
# 项目配置: 名称、日志目录
project:
name: sa-admin
log-directory: /home/project/smartadmin/sit/log
log-directory: /home/project/smartadmin/test/log
# 项目端口和url根路径
server:

View File

@@ -14,15 +14,24 @@ import java.io.IOException;
* @Date 2020-06-02 22:55:07
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
public class LongJsonSerializer extends JsonSerializer<Long> {
public static final LongJsonSerializer INSTANCE = new LongJsonSerializer();
@Override
public void serialize(Long value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
String text = (value == null ? null : String.valueOf(value));
if (text != null) {
jsonGenerator.writeString(text);
public void serialize(Long value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
if (null == value) {
gen.writeNull();
return;
}
// js中最大安全整数16位 Number.MAX_SAFE_INTEGER
String longStr = String.valueOf(value);
if (longStr.length() > 16) {
gen.writeString(longStr);
} else {
gen.writeNumber(value);
}
}
}

View File

@@ -6,6 +6,7 @@ import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import net.lab1024.sa.base.common.json.serializer.LongJsonSerializer;
import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.context.annotation.Bean;
@@ -17,16 +18,16 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeParseException;
/**
* java8 localDate 时间类格式化配置
* Json 序列化配置
*
* @Author 1024创新实验室-主任: 卓大
* @Date 2017-11-28 15:21:10
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Configuration
public class DateConfig {
public class JsonConfig {
@Bean
public Jackson2ObjectMapperBuilderCustomizer customizer() {
@@ -35,6 +36,7 @@ public class DateConfig {
builder.deserializers(new LocalDateTimeDeserializer(DatePattern.NORM_DATETIME_FORMAT.getDateTimeFormatter()));
builder.serializers(new LocalDateSerializer(DatePattern.NORM_DATE_FORMAT.getDateTimeFormatter()));
builder.serializers(new LocalDateTimeSerializer(DatePattern.NORM_DATETIME_FORMAT.getDateTimeFormatter()));
builder.serializerByType(Long.class, LongJsonSerializer.INSTANCE);
};
}

View File

@@ -31,10 +31,9 @@ import java.util.Optional;
/**
* springdoc-openapi 配置
* nginx配置前缀时如果需要访问【/swagger-ui/index.html】需添加额外nginx配置
* location /v3/api-docs/ {
* proxy_pass http://127.0.0.1:11024/v3/api-docs/;
* location /v3/api-docs/ {
* proxy_pass http://127.0.0.1:1024/v3/api-docs/;
* }
*
* @Author 1024创新实验室-主任: 卓大
* @Date 2020-03-25 22:54:46
* @Wechat zhuoda1024
@@ -48,7 +47,7 @@ public class SwaggerConfig {
/**
* 用于解决/swagger-ui/index.html页面ServersUrl 测试环境部署错误问题
*/
@Value("${springdoc.swagger-ui.server-base-url:''}")
@Value("${springdoc.swagger-ui.server-base-url}")
private String serverBaseUrl;
public static final String[] SWAGGER_WHITELIST = {
@@ -59,20 +58,20 @@ public class SwaggerConfig {
"/v3/api-docs",
"/v3/api-docs/**",
"/doc.html",
};
};
@Bean
public OpenAPI api() {
return new OpenAPI()
.components(components())
.info(new Info()
.title("SmartAdmin 3.X 接口文档")
.contact(new Contact().name("1024创新实验室").email("lab1024@163.com").url("https://1024lab.net"))
.version("v3.X")
.description("<font color=\"#DC143C\">**以「高质量代码」为核心,「简洁、高效、安全」**</font>基于 SpringBoot + Sa-Token + Mybatis-Plus 和 Vue3 + Vite5 + Ant Design (同时支持JavaScript和TypeScript双版本) 的快速开发平台。" +
"<br/><font color=\"#DC143C\">**国内首个满足《网络安全》、《数据安全》、三级等保**</font> 支持登录限制、支持国产接口加解密等安全、支持数据加解密等一系列安全体系的开源项目。" +
"<br/><font color=\"#DC143C\">**我们开源一套漂亮的代码和一套整洁的代码规范**</font>,让大家在这浮躁的代码世界里感受到一股把代码写好的清流!同时又让开发者节省大量的时间,减少加班,快乐工作,保持谦逊,保持学习,热爱代码,更热爱生活!")
)
.title("SmartAdmin 3.X 接口文档")
.contact(new Contact().name("1024创新实验室").email("lab1024@163.com").url("https://1024lab.net"))
.version("v3.X")
.description("<font color=\"#DC143C\">**以「高质量代码」为核心,「简洁、高效、安全」**</font>基于 SpringBoot + Sa-Token + Mybatis-Plus 和 Vue3 + Vite5 + Ant Design (同时支持JavaScript和TypeScript双版本) 的快速开发平台。" +
"<br/><font color=\"#DC143C\">**国内首个满足《网络安全》、《数据安全》、三级等保**</font> 支持登录限制、支持国产接口加解密等安全、支持数据加解密等一系列安全体系的开源项目。" +
"<br/><font color=\"#DC143C\">**我们开源一套漂亮的代码和一套整洁的代码规范**</font>,让大家在这浮躁的代码世界里感受到一股把代码写好的清流!同时又让开发者节省大量的时间,减少加班,快乐工作,保持谦逊,保持学习,热爱代码,更热爱生活!")
)
.addSecurityItem(new SecurityRequirement().addList(RequestHeaderConst.TOKEN));
}
@@ -84,27 +83,26 @@ public class SwaggerConfig {
@Bean
public GroupedOpenApi businessApi() {
return GroupedOpenApi.builder()
.group("业务接口")
.pathsToMatch("/**")
.pathsToExclude(SwaggerTagConst.Support.URL_PREFIX + "/**")
.addOperationCustomizer(new SmartOperationCustomizer())
.build();
.group("业务接口")
.pathsToMatch("/**")
.pathsToExclude(SwaggerTagConst.Support.URL_PREFIX + "/**")
.addOperationCustomizer(new SmartOperationCustomizer())
.build();
}
@Bean
public GroupedOpenApi supportApi() {
return GroupedOpenApi.builder()
.group("支撑接口(Support)")
.pathsToMatch(SwaggerTagConst.Support.URL_PREFIX + "/**")
.addOperationCustomizer(new SmartOperationCustomizer())
.build();
.group("支撑接口(Support)")
.pathsToMatch(SwaggerTagConst.Support.URL_PREFIX + "/**")
.addOperationCustomizer(new SmartOperationCustomizer())
.build();
}
/**
* 以下代码可以用于设置 /swagger-ui/index.html 的serverBaseUrl
* 如果使用knife4j则不需要
*
* @param openAPI
* @param securityParser
* @param springDocConfigProperties
@@ -132,6 +130,6 @@ public class SwaggerConfig {
}
});
return new OpenAPIService(openAPI, securityParser, springDocConfigProperties,
propertyResolverUtils, openApiBuilderCustomizers, Optional.of(list), javadocProvider);
propertyResolverUtils, openApiBuilderCustomizers, Optional.of(list), javadocProvider);
}
}

View File

@@ -28,7 +28,7 @@ import java.util.Set;
* @Date 2022-05-30 21:22:12
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Configuration
@Slf4j

View File

@@ -67,14 +67,14 @@ public class WebServerListener implements ApplicationListener<WebServerInitializ
String swaggerUrl = URLUtil.normalize(String.format("http://localhost:%d%s/swagger-ui/index.html", port, contextPath), false, true);
String knife4jUrl = URLUtil.normalize(String.format("http://localhost:%d%s/doc.html", port, contextPath), false, true);
log.warn("\n{}\n" +
"\t当前启动环境:\t{} , {}" +
"\n\t返回码初始化:\t完成{}个返回码初始化" +
"\n\t服务本机地址:\t{}" +
"\n\t服务外网地址:\t{}" +
"\n\tSwagger地址:\t{}" +
"\n\tknife4j地址:\t{}" +
"\n-------------------------------------------------------------------------------------\n",
title, profile, environmentEnum.getDesc(), codeCount, localhostUrl, externalUrl, swaggerUrl, knife4jUrl);
"\t当前启动环境:\t{} , {}" +
"\n\t返回码初始化:\t完成{}个返回码初始化" +
"\n\t服务本机地址:\t{}" +
"\n\t服务外网地址:\t{}" +
"\n\tSwagger地址:\t{}" +
"\n\tknife4j地址:\t{}" +
"\n-------------------------------------------------------------------------------------\n",
title, profile, environmentEnum.getDesc(), codeCount, localhostUrl, externalUrl, swaggerUrl, knife4jUrl);
}
/**

View File

@@ -1,6 +1,8 @@
package net.lab1024.sa.base.module.support.apiencrypt.advice;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import net.lab1024.sa.base.common.domain.ResponseDTO;
@@ -33,6 +35,9 @@ public class EncryptResponseAdvice implements ResponseBodyAdvice<ResponseDTO> {
@Resource
private ApiEncryptService apiEncryptService;
@Resource
private ObjectMapper objectMapper;
@Override
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
return returnType.hasMethodAnnotation(ApiEncrypt.class) || returnType.getContainingClass().isAnnotationPresent(ApiEncrypt.class);
@@ -44,7 +49,12 @@ public class EncryptResponseAdvice implements ResponseBodyAdvice<ResponseDTO> {
return body;
}
String encrypt = apiEncryptService.encrypt(JSON.toJSONString(body.getData()));
String encrypt = null;
try {
encrypt = apiEncryptService.encrypt(objectMapper.writeValueAsString(body.getData()));
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
body.setData(encrypt);
body.setDataType(DataTypeEnum.ENCRYPT.getValue());
return body;

View File

@@ -52,14 +52,6 @@ public class ApiEncryptServiceSmImpl implements ApiEncryptService {
}
}
public static void main(String[] args) {
String content = "zkm1024";
String en = new ApiEncryptServiceSmImpl().encrypt(content);
System.out.println(en);
String ori = new ApiEncryptServiceSmImpl().decrypt(en);
System.out.println(ori);
}
@Override
public String decrypt(String data) {

View File

@@ -45,7 +45,7 @@ import java.util.stream.Collectors;
* @Date 2022-06-30 22:15:38
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Service

View File

@@ -18,7 +18,7 @@ import java.util.stream.Collectors;
* @Date 2022/9/29 17:20:41
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
public abstract class CodeGenerateBaseVariableService {

View File

@@ -101,7 +101,6 @@ public class AddFormVariableService extends CodeGenerateBaseVariableService {
}
}
//字典
if (SmartStringUtil.isNotEmpty(codeField.getDict())) {
finalFieldMap.put("dict", "\n @JsonDeserialize(using = DictValueVoDeserializer.class)");

View File

@@ -15,7 +15,7 @@ import java.util.*;
* @Date 2022/9/29 17:20:41
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
public class MapperVariableService extends CodeGenerateBaseVariableService {

View File

@@ -18,7 +18,7 @@ import java.util.stream.Collectors;
* @Date 2022/9/29 17:20:41
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
public class QueryFormVariableService extends CodeGenerateBaseVariableService {

View File

@@ -17,7 +17,7 @@ import java.util.stream.Collectors;
* @Date 2022/9/29 17:20:41
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
public class VOVariableService extends CodeGenerateBaseVariableService {

View File

@@ -39,7 +39,7 @@ import java.util.stream.Collectors;
* @Date 2019年10月11日 15:34:47
* @Wechat zhuoda1024
* @Email lab1024@163.com
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
*/
@Service
public class FileService {

View File

@@ -40,7 +40,7 @@ spring:
host: smtp.163.com
port: 465
username: lab1024@163.com
password: 1
password: LAB1024LAB
properties:
mail:
smtp:

View File

@@ -40,7 +40,7 @@ spring:
host: smtp.163.com
port: 465
username: lab1024@163.com
password: 1
password: LAB1024LAB
properties:
mail:
smtp:

View File

@@ -30,16 +30,17 @@ spring:
timeout: 10000ms
lettuce:
pool:
max-active: 100
min-idle: 10
max-idle: 50
max-active: 5
min-idle: 1
max-idle: 3
max-wait: 30000ms
# 邮件置以SSL的方式发送, 这个需要使用这种方式并且端口是465
mail:
host: smtp.163.com
port: 465
username: lab1024@163.com
password: 1024lab
password: LAB1024LAB
properties:
mail:
smtp:

View File

@@ -40,7 +40,7 @@ spring:
host: smtp.163.com
port: 465
username: lab1024@163.com
password: 1
password: LAB1024LAB
properties:
mail:
smtp:

View File

@@ -0,0 +1 @@
# Smart Admin API

View File

@@ -86,7 +86,7 @@ public class AdminInterceptor implements HandlerInterceptor {
Method method = ((HandlerMethod) handler).getMethod();
NoNeedLogin noNeedLogin = ((HandlerMethod) handler).getMethodAnnotation(NoNeedLogin.class);
if (noNeedLogin != null) {
checkActiveTimeout(requestEmployee,debugNumberTokenFlag);
checkActiveTimeout(requestEmployee, debugNumberTokenFlag);
return true;
}
@@ -96,7 +96,7 @@ public class AdminInterceptor implements HandlerInterceptor {
}
// 检测token 活跃频率
checkActiveTimeout(requestEmployee,debugNumberTokenFlag);
checkActiveTimeout(requestEmployee, debugNumberTokenFlag);
// --------------- 第三步 校验 权限 ---------------
@@ -107,8 +107,8 @@ public class AdminInterceptor implements HandlerInterceptor {
}
// 如果是超级管理员的话不需要校验权限
if(requestEmployee.getAdministratorFlag()){
return true;
if (requestEmployee.getAdministratorFlag()) {
return true;
}
SaStrategy.instance.checkMethodAnnotation.accept(method);

Some files were not shown because too many files have changed in this diff Show More