refactor(core): rename Cs prefix to Kit for base classes and utilities
- Renamed CsArgs to KitArgs and updated internal references - Renamed CsBaseCreateTimeTb to KitBaseCreateTimeTb and extended KitObject - Renamed CsBaseTimeTb to KitBaseTimeTb and extended KitObject - Renamed CsBaseUpdateTimeTb to KitBaseUpdateTimeTb and extended KitObject - Renamed CsBaseUserCreateTimeTb to KitBaseUserCreateTimeTb and extended KitObject - Renamed CsBaseUserTimeLogicTb to KitBaseUserTimeLogicTb and extended KitObject - Renamed CsBaseUserTimeTb to KitBaseUserTimeTb and extended KitObject - Renamed CsObject to KitObject as base serializable class - Renamed CsPageArgs to KitPageArgs and kept same generic structure - Renamed CsPageResult to KitPageResult and updated factory methods - Renamed CsSelectOptionVo to KitSelectOptionVo and extended KitObject - Updated BootApplication to use KitSpringBeanHolder instead of CsSpringBeanHolder - Renamed CsRequestHolder to KitRequestHolder and kept same functionality - Renamed CsScriptHelper to KitScriptHelper and maintained component behavior - Renamed CsSpringBeanHolder to KitSpringBeanHolder and updated internal usage - Updated SwaggerConfig to import KitAnonTagUtil instead of CsAnonTagUtil - Renamed CsHealthCheckPointService to KitHealthCheckPointService in controller and service layers - Renamed CsMpQTypeEnum to KitMpQTypeEnum for dynamic query types - Renamed CsMpQuery annotation to KitMpQuery and updated default type reference - Renamed CsMpMapper to KitMpMapper and updated imports for page utilities - Renamed CsMpService to KitMpService and updated page result references - Renamed CsMpServiceImpl to KitMpServiceImpl and updated query utility usage - Renamed CsMpAnyQUtil to KitMpAnyQUtil and updated internal query builder calls - Renamed CsMpCmdGenUtil to KitMpCmdGenUtil and updated superclass reference - Renamed CsMpQUtil to KitMpQUtil and updated annotation and handler references - Updated model classes (CaptchaModel, ContentRsaEncodeSettingModel, JwtAuthSettingModel, OSSConfigModel) to extend KitObject instead of CsObject
This commit is contained in:
+3
-3
@@ -26,17 +26,17 @@ import lombok.Setter;
|
||||
* @author odboy
|
||||
* @date 2025-07-23
|
||||
*/
|
||||
public class CsArgs {
|
||||
public class KitArgs {
|
||||
@Getter
|
||||
@Setter
|
||||
public static class FindByLongId extends CsObject {
|
||||
public static class FindByLongId extends KitObject {
|
||||
@NotNull(message = "id必填")
|
||||
private Long id;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class DeleteById extends CsObject {
|
||||
public static class DeleteById extends KitObject {
|
||||
@NotNull(message = "id必填")
|
||||
private Long id;
|
||||
}
|
||||
+1
-1
@@ -28,7 +28,7 @@ import java.util.Date;
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CsBaseCreateTimeTb extends CsObject {
|
||||
public class KitBaseCreateTimeTb extends KitObject {
|
||||
@Schema(name = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
+1
-1
@@ -28,7 +28,7 @@ import java.util.Date;
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CsBaseTimeTb extends CsObject {
|
||||
public class KitBaseTimeTb extends KitObject {
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(name = "创建时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
private Date createTime;
|
||||
+1
-1
@@ -28,7 +28,7 @@ import java.util.Date;
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CsBaseUpdateTimeTb extends CsObject {
|
||||
public class KitBaseUpdateTimeTb extends KitObject {
|
||||
@Schema(name = "更新时间: yyyy-MM-dd HH:mm:ss", hidden = true)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private Date updateTime;
|
||||
+1
-1
@@ -31,7 +31,7 @@ import java.util.Date;
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CsBaseUserCreateTimeTb extends CsObject {
|
||||
public class KitBaseUserCreateTimeTb extends KitObject {
|
||||
|
||||
@CreatedBy
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
+1
-1
@@ -35,7 +35,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class CsBaseUserTimeLogicTb extends CsObject {
|
||||
public class KitBaseUserTimeLogicTb extends KitObject {
|
||||
@CreatedBy
|
||||
@TableField(value = "create_by", fill = FieldFill.INSERT)
|
||||
@Schema(name = "创建人", hidden = true)
|
||||
+1
-1
@@ -32,7 +32,7 @@ import java.util.Date;
|
||||
@Getter
|
||||
@Setter
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CsBaseUserTimeTb extends CsObject {
|
||||
public class KitBaseUserTimeTb extends KitObject {
|
||||
|
||||
@CreatedBy
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
+1
-1
@@ -25,7 +25,7 @@ import java.io.Serializable;
|
||||
* @author odboy
|
||||
* @date 2022-01-12
|
||||
*/
|
||||
public class CsObject implements Serializable {
|
||||
public class KitObject implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
+1
-1
@@ -34,7 +34,7 @@ import java.io.Serializable;
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class CsPageArgs<T> implements Serializable {
|
||||
public class KitPageArgs<T> implements Serializable {
|
||||
@NotNull(message = "参数page不能为空")
|
||||
@Min(value = 1, message = "参数page最小值为1")
|
||||
@Schema(name = "页码", example = "1")
|
||||
+5
-5
@@ -32,19 +32,19 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CsPageResult<T> extends CsObject {
|
||||
public class KitPageResult<T> extends KitObject {
|
||||
private List<T> content;
|
||||
private long totalElements;
|
||||
|
||||
public static <T> CsPageResult<T> emptyListData() {
|
||||
CsPageResult<T> result = new CsPageResult<>();
|
||||
public static <T> KitPageResult<T> emptyListData() {
|
||||
KitPageResult<T> result = new KitPageResult<>();
|
||||
result.setTotalElements(0);
|
||||
result.setContent(new ArrayList<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
public static <T> CsPageResult<T> listData(IPage<T> page) {
|
||||
CsPageResult<T> result = new CsPageResult<>();
|
||||
public static <T> KitPageResult<T> listData(IPage<T> page) {
|
||||
KitPageResult<T> result = new KitPageResult<>();
|
||||
result.setTotalElements(page.getTotal());
|
||||
result.setContent(page.getRecords());
|
||||
return result;
|
||||
+1
-1
@@ -31,7 +31,7 @@ import java.util.Map;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class CsSelectOptionVo extends CsObject {
|
||||
public class KitSelectOptionVo extends KitObject {
|
||||
private String label;
|
||||
private String value;
|
||||
private Map<String, Object> ext;
|
||||
+2
-2
@@ -48,7 +48,7 @@ public class BootApplication {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CsSpringBeanHolder springBeanHolder() {
|
||||
return new CsSpringBeanHolder();
|
||||
public KitSpringBeanHolder springBeanHolder() {
|
||||
return new KitSpringBeanHolder();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -26,7 +26,7 @@ import java.util.Objects;
|
||||
/**
|
||||
* 获取 HttpServletRequest
|
||||
*/
|
||||
public class CsRequestHolder {
|
||||
public class KitRequestHolder {
|
||||
|
||||
public static HttpServletRequest getHttpServletRequest() {
|
||||
return ((ServletRequestAttributes)Objects.requireNonNull(RequestContextHolder.getRequestAttributes())).getRequest();
|
||||
+1
-1
@@ -31,7 +31,7 @@ import java.util.Map;
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CsScriptHelper {
|
||||
public class KitScriptHelper {
|
||||
public Object evalObj(String script, Map<String, Object> args) {
|
||||
try (Context rhino = Context.enter()) {
|
||||
Scriptable scope = rhino.initStandardObjects();
|
||||
+8
-8
@@ -30,7 +30,7 @@ import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@SuppressWarnings({"unchecked", "all"})
|
||||
public class CsSpringBeanHolder implements ApplicationContextAware, DisposableBean {
|
||||
public class KitSpringBeanHolder implements ApplicationContextAware, DisposableBean {
|
||||
|
||||
private static final List<CallBack> CALL_BACKS = new ArrayList<>();
|
||||
private static ApplicationContext applicationContext = null;
|
||||
@@ -43,7 +43,7 @@ public class CsSpringBeanHolder implements ApplicationContextAware, DisposableBe
|
||||
*/
|
||||
public synchronized static void addCallBacks(CallBack callBack) {
|
||||
if (addCallback) {
|
||||
CsSpringBeanHolder.CALL_BACKS.add(callBack);
|
||||
KitSpringBeanHolder.CALL_BACKS.add(callBack);
|
||||
} else {
|
||||
log.warn("CallBack:{} 已无法添加!立即执行", callBack.getCallBackName());
|
||||
callBack.executor();
|
||||
@@ -133,22 +133,22 @@ public class CsSpringBeanHolder implements ApplicationContextAware, DisposableBe
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
CsSpringBeanHolder.clearHolder();
|
||||
KitSpringBeanHolder.clearHolder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
if (CsSpringBeanHolder.applicationContext != null) {
|
||||
log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + CsSpringBeanHolder.applicationContext);
|
||||
if (KitSpringBeanHolder.applicationContext != null) {
|
||||
log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + KitSpringBeanHolder.applicationContext);
|
||||
}
|
||||
CsSpringBeanHolder.applicationContext = applicationContext;
|
||||
KitSpringBeanHolder.applicationContext = applicationContext;
|
||||
if (addCallback) {
|
||||
for (CallBack callBack : CsSpringBeanHolder.CALL_BACKS) {
|
||||
for (CallBack callBack : KitSpringBeanHolder.CALL_BACKS) {
|
||||
callBack.executor();
|
||||
}
|
||||
CALL_BACKS.clear();
|
||||
}
|
||||
CsSpringBeanHolder.addCallback = false;
|
||||
KitSpringBeanHolder.addCallback = false;
|
||||
}
|
||||
|
||||
interface CallBack {
|
||||
+4
-4
@@ -17,7 +17,7 @@
|
||||
package cn.odboy.framework.monitor.controller;
|
||||
|
||||
import cn.odboy.annotation.AnonymousGetMapping;
|
||||
import cn.odboy.framework.monitor.service.CsHealthCheckPointService;
|
||||
import cn.odboy.framework.monitor.service.KitHealthCheckPointService;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -32,14 +32,14 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Tag(name = "系统:健康检查接口")
|
||||
public class HealthCheckController {
|
||||
@Autowired
|
||||
private CsHealthCheckPointService healthCheckPointService;
|
||||
private KitHealthCheckPointService kitHealthCheckPointService;
|
||||
|
||||
/**
|
||||
* 就绪检查
|
||||
*/
|
||||
@AnonymousGetMapping(value = "/readiness")
|
||||
public ResponseEntity<?> doReadiness() {
|
||||
return healthCheckPointService.doReadiness();
|
||||
return kitHealthCheckPointService.doReadiness();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ public class HealthCheckController {
|
||||
*/
|
||||
@AnonymousGetMapping(value = "/liveness")
|
||||
public ResponseEntity<?> doLiveness() {
|
||||
return healthCheckPointService.doLiveness();
|
||||
return kitHealthCheckPointService.doLiveness();
|
||||
}
|
||||
|
||||
// /**
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ package cn.odboy.framework.monitor.service;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
public interface CsHealthCheckPointService {
|
||||
public interface KitHealthCheckPointService {
|
||||
/**
|
||||
* 就绪检查
|
||||
*/
|
||||
+1
-1
@@ -19,7 +19,7 @@ package cn.odboy.framework.mybatisplus.config;
|
||||
/**
|
||||
* 动态查询 枚举
|
||||
*/
|
||||
public enum CsMpQTypeEnum {
|
||||
public enum KitMpQTypeEnum {
|
||||
/**
|
||||
* 相等
|
||||
*/
|
||||
+2
-2
@@ -28,7 +28,7 @@ import java.lang.annotation.Target;
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface CsMpQuery {
|
||||
public @interface KitMpQuery {
|
||||
/**
|
||||
* 基本对象的属性名
|
||||
*/
|
||||
@@ -37,7 +37,7 @@ public @interface CsMpQuery {
|
||||
/**
|
||||
* 查询方式
|
||||
*/
|
||||
CsMpQTypeEnum type() default CsMpQTypeEnum.EQUAL;
|
||||
KitMpQTypeEnum type() default KitMpQTypeEnum.EQUAL;
|
||||
|
||||
/**
|
||||
* 多字段模糊搜索, 仅支持String类型字段, 多个用逗号隔开, 如@MpQuery(blurry = "email,username")
|
||||
+8
-8
@@ -30,14 +30,14 @@ import java.util.List;
|
||||
* @author odboy
|
||||
* @date 2025-05-15
|
||||
*/
|
||||
public class CsMpAnyQUtil {
|
||||
public class KitMpAnyQUtil {
|
||||
public static <T> T selectOne(BaseMapper<T> baseMapper, Object queryParams) {
|
||||
QueryWrapper<T> queryWrapper = CsMpQUtil.build(queryParams);
|
||||
QueryWrapper<T> queryWrapper = KitMpQUtil.build(queryParams);
|
||||
return baseMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
public static <T, M> M selectOne(BaseMapper<T> baseMapper, Object queryParams, Class<M> mapperClazz) {
|
||||
QueryWrapper<T> queryWrapper = CsMpQUtil.build(queryParams);
|
||||
QueryWrapper<T> queryWrapper = KitMpQUtil.build(queryParams);
|
||||
T mapperTarget = baseMapper.selectOne(queryWrapper);
|
||||
if (mapperTarget == null) {
|
||||
return null;
|
||||
@@ -46,12 +46,12 @@ public class CsMpAnyQUtil {
|
||||
}
|
||||
|
||||
public static <T> List<T> selectList(BaseMapper<T> baseMapper, Object queryParams) {
|
||||
QueryWrapper<T> queryWrapper = CsMpQUtil.build(queryParams);
|
||||
QueryWrapper<T> queryWrapper = KitMpQUtil.build(queryParams);
|
||||
return baseMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
public static <T, M> List<M> selectList(BaseMapper<T> baseMapper, Object queryParams, Class<M> mapperClazz) {
|
||||
QueryWrapper<T> queryWrapper = CsMpQUtil.build(queryParams);
|
||||
QueryWrapper<T> queryWrapper = KitMpQUtil.build(queryParams);
|
||||
List<T> mapperTarget = baseMapper.selectList(queryWrapper);
|
||||
if (mapperTarget == null) {
|
||||
return new ArrayList<>();
|
||||
@@ -60,17 +60,17 @@ public class CsMpAnyQUtil {
|
||||
}
|
||||
|
||||
public static <T> Long selectCount(BaseMapper<T> baseMapper, Object queryParams) {
|
||||
QueryWrapper<T> queryWrapper = CsMpQUtil.build(queryParams);
|
||||
QueryWrapper<T> queryWrapper = KitMpQUtil.build(queryParams);
|
||||
return baseMapper.selectCount(queryWrapper);
|
||||
}
|
||||
|
||||
public static <T> Page<T> selectPage(BaseMapper<T> baseMapper, Page<T> page, Object queryParams) {
|
||||
QueryWrapper<T> queryWrapper = CsMpQUtil.build(queryParams);
|
||||
QueryWrapper<T> queryWrapper = KitMpQUtil.build(queryParams);
|
||||
return baseMapper.selectPage(page, queryWrapper);
|
||||
}
|
||||
|
||||
public static <T, M> Page<M> selectPage(BaseMapper<T> baseMapper, Page<T> page, Object queryParams, Class<M> mapperClazz) {
|
||||
QueryWrapper<T> queryWrapper = CsMpQUtil.build(queryParams);
|
||||
QueryWrapper<T> queryWrapper = KitMpQUtil.build(queryParams);
|
||||
Page<T> tPage = baseMapper.selectPage(page, queryWrapper);
|
||||
Page<M> mapperTarget = new Page<>();
|
||||
mapperTarget.setRecords(BeanUtil.copyToList(tPage.getRecords(), mapperClazz));
|
||||
+3
-3
@@ -17,7 +17,7 @@
|
||||
package cn.odboy.framework.mybatisplus.core;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.CsBaseUserTimeTb;
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
|
||||
@@ -44,7 +44,7 @@ import java.util.function.Consumer;
|
||||
* @date 2025-01-11
|
||||
*/
|
||||
@Data
|
||||
public class CsMpCmdGenUtil {
|
||||
public class KitMpCmdGenUtil {
|
||||
// 项目根路径。生成结果 C:\Users\Administrator\Documents\GitHub\cutejava\cutejava
|
||||
private static final String projectRootPath = System.getProperty("user.dir") + "/";
|
||||
/**
|
||||
@@ -74,7 +74,7 @@ public class CsMpCmdGenUtil {
|
||||
private static Consumer<StrategyConfig.Builder> getStrategyConfigConsumer(List<String> tableNames) {
|
||||
return strategyConfigBuilder -> strategyConfigBuilder.enableCapitalMode().enableSkipView().disableSqlFilter().addInclude(tableNames)
|
||||
// 实体类生成策略
|
||||
.entityBuilder().superClass(CsBaseUserTimeTb.class).addIgnoreColumns("create_time", "update_time", "create_by", "update_by")
|
||||
.entityBuilder().superClass(KitBaseUserTimeTb.class).addIgnoreColumns("create_time", "update_time", "create_by", "update_by")
|
||||
// 开启生成实体时生成字段注解。
|
||||
// 会在实体类的属性前,添加[@TableField("nickname")]
|
||||
.enableTableFieldAnnotation().disableSerialVersionUID()
|
||||
+7
-7
@@ -19,9 +19,9 @@ package cn.odboy.framework.mybatisplus.core;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.CsBaseUserTimeTb;
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.mybatisplus.config.CsMpQuery;
|
||||
import cn.odboy.framework.mybatisplus.config.KitMpQuery;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -38,7 +38,7 @@ import java.util.*;
|
||||
* 查询条件创建工具
|
||||
*/
|
||||
@Slf4j
|
||||
public class CsMpQUtil {
|
||||
public class KitMpQUtil {
|
||||
public static <R, Q> QueryWrapper<R> build(Q query) {
|
||||
QueryWrapper<R> queryWrapper = new QueryWrapper<>();
|
||||
if (query == null) {
|
||||
@@ -50,7 +50,7 @@ public class CsMpQUtil {
|
||||
for (Field field : fields) {
|
||||
if (!field.canAccess(query)) {
|
||||
field.setAccessible(true);
|
||||
CsMpQuery q = field.getAnnotation(CsMpQuery.class);
|
||||
KitMpQuery q = field.getAnnotation(KitMpQuery.class);
|
||||
if (q != null) {
|
||||
String attributeName = getAttributeName(q, field);
|
||||
Object fieldVal = field.get(query);
|
||||
@@ -72,12 +72,12 @@ public class CsMpQUtil {
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
private static String getAttributeName(CsMpQuery q, Field field) {
|
||||
private static String getAttributeName(KitMpQuery q, Field field) {
|
||||
String attributeName = StrUtil.isBlank(q.propName()) ? field.getName() : q.propName();
|
||||
return StrUtil.toUnderlineCase(attributeName);
|
||||
}
|
||||
|
||||
private static <R> void handleWrapper(CsMpQuery q, QueryWrapper<R> queryWrapper, String attributeName, Object fieldVal) {
|
||||
private static <R> void handleWrapper(KitMpQuery q, QueryWrapper<R> queryWrapper, String attributeName, Object fieldVal) {
|
||||
switch (q.type()) {
|
||||
case EQUAL -> queryWrapper.eq(attributeName, fieldVal);
|
||||
case GREATER_THAN -> queryWrapper.ge(attributeName, fieldVal);
|
||||
@@ -182,7 +182,7 @@ public class CsMpQUtil {
|
||||
|
||||
@TableName("test_domain")
|
||||
private static class TestDomain {
|
||||
@NotNull(groups = CsBaseUserTimeTb.Update.class)
|
||||
@NotNull(groups = KitBaseUserTimeTb.Update.class)
|
||||
@TableId(value = "user_id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@TableField(value = "dept_id")
|
||||
+9
-9
@@ -19,8 +19,8 @@ package cn.odboy.framework.mybatisplus.core.interfaces;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.odboy.base.CsPageResult;
|
||||
import cn.odboy.util.CsPageUtil;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.util.KitPageUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -42,7 +42,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* @author odboy
|
||||
* @date 2022-04-03
|
||||
*/
|
||||
public interface CsMpMapper<E> extends BaseMapper<E> {
|
||||
public interface KitMpMapper<E> extends BaseMapper<E> {
|
||||
/**
|
||||
* 批量插入
|
||||
*
|
||||
@@ -137,16 +137,16 @@ public interface CsMpMapper<E> extends BaseMapper<E> {
|
||||
* @param clazz 期望的对象类型
|
||||
* @return IPage<T>
|
||||
*/
|
||||
default <T> CsPageResult<T> queryFeatureClazzPage(Pageable pageable, LambdaQueryWrapper<E> wrapper, Class<T> clazz) {
|
||||
default <T> KitPageResult<T> queryFeatureClazzPage(Pageable pageable, LambdaQueryWrapper<E> wrapper, Class<T> clazz) {
|
||||
int pageNumber = pageable.getPageNumber();
|
||||
int pageSize = pageable.getPageSize();
|
||||
pageNumber = pageNumber <= 0 ? 1 : pageNumber;
|
||||
pageSize = pageSize <= 0 ? 10 : pageSize;
|
||||
IPage<E> pageInfo = this.selectPage(new Page<>(pageNumber, pageSize), wrapper);
|
||||
if (CollUtil.isEmpty(pageInfo.getRecords())) {
|
||||
return new CsPageResult<>(new ArrayList<>(), pageInfo.getTotal());
|
||||
return new KitPageResult<>(new ArrayList<>(), pageInfo.getTotal());
|
||||
}
|
||||
return new CsPageResult<>(BeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
||||
return new KitPageResult<>(BeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,16 +157,16 @@ public interface CsMpMapper<E> extends BaseMapper<E> {
|
||||
* @param clazz 期望的对象类型
|
||||
* @return IPage<T>
|
||||
*/
|
||||
default <T> CsPageResult<T> queryFeatureClazzPage(Pageable pageable, LambdaQueryChainWrapper<E> wrapper, Class<T> clazz) {
|
||||
default <T> KitPageResult<T> queryFeatureClazzPage(Pageable pageable, LambdaQueryChainWrapper<E> wrapper, Class<T> clazz) {
|
||||
int pageNumber = pageable.getPageNumber();
|
||||
int pageSize = pageable.getPageSize();
|
||||
pageNumber = pageNumber <= 0 ? 1 : pageNumber;
|
||||
pageSize = pageSize <= 0 ? 10 : pageSize;
|
||||
IPage<E> pageInfo = wrapper.page(new Page<>(pageNumber, pageSize));
|
||||
if (CollUtil.isEmpty(pageInfo.getRecords())) {
|
||||
return CsPageUtil.emptyListData();
|
||||
return KitPageUtil.emptyListData();
|
||||
}
|
||||
return new CsPageResult<>(BeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
||||
return new KitPageResult<>(BeanUtil.copyToList(pageInfo.getRecords(), clazz), pageInfo.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
+6
-6
@@ -16,7 +16,7 @@
|
||||
|
||||
package cn.odboy.framework.mybatisplus.core.interfaces;
|
||||
|
||||
import cn.odboy.base.CsPageResult;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
|
||||
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
* @author odboy
|
||||
* @date 2022-04-03
|
||||
*/
|
||||
public interface CsMpService<T> extends IService<T> {
|
||||
public interface KitMpService<T> extends IService<T> {
|
||||
<G> int saveFeatureClazz(G resources);
|
||||
|
||||
<G> int saveFeatureClazzList(List<G> resources);
|
||||
@@ -57,13 +57,13 @@ public interface CsMpService<T> extends IService<T> {
|
||||
|
||||
<G> List<G> queryFeatureClazzListByArgs(LambdaQueryWrapper<T> wrapper, Class<G> targetClazz);
|
||||
|
||||
CsPageResult<T> queryClazzPageByArgs(LambdaQueryWrapper<T> wrapper, IPage<T> pageable);
|
||||
KitPageResult<T> queryClazzPageByArgs(LambdaQueryWrapper<T> wrapper, IPage<T> pageable);
|
||||
|
||||
<G> CsPageResult<G> queryFeatureClazzPageByArgs(LambdaQueryWrapper<T> wrapper, IPage<T> pageable, Class<G> targetClazz);
|
||||
<G> KitPageResult<G> queryFeatureClazzPageByArgs(LambdaQueryWrapper<T> wrapper, IPage<T> pageable, Class<G> targetClazz);
|
||||
|
||||
<G, Q> CsPageResult<G> queryFeatureClazzPageByArgs(Q criteria, IPage<T> pageable, Class<G> targetClazz);
|
||||
<G, Q> KitPageResult<G> queryFeatureClazzPageByArgs(Q criteria, IPage<T> pageable, Class<G> targetClazz);
|
||||
|
||||
<Q> CsPageResult<T> queryClazzPageByArgs(Q criteria, IPage<T> pageable);
|
||||
<Q> KitPageResult<T> queryClazzPageByArgs(Q criteria, IPage<T> pageable);
|
||||
|
||||
int modifyClazzByArgs(LambdaQueryWrapper<T> wrapper, T entity);
|
||||
|
||||
+15
-15
@@ -18,9 +18,9 @@ package cn.odboy.framework.mybatisplus.core.interfaces;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.odboy.base.CsPageResult;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import cn.odboy.framework.mybatisplus.core.CsMpQUtil;
|
||||
import cn.odboy.framework.mybatisplus.core.KitMpQUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.enums.SqlMethod;
|
||||
@@ -39,7 +39,7 @@ import java.util.List;
|
||||
* @author odboy
|
||||
* @date 2022-04-03
|
||||
*/
|
||||
public class CsMpServiceImpl<M extends CsMpMapper<T>, T> extends ServiceImpl<M, T> {
|
||||
public class KitMpServiceImpl<M extends KitMpMapper<T>, T> extends ServiceImpl<M, T> {
|
||||
/**
|
||||
* 快速插入
|
||||
*
|
||||
@@ -147,7 +147,7 @@ public class CsMpServiceImpl<M extends CsMpMapper<T>, T> extends ServiceImpl<M,
|
||||
* @param criteria 动态条件
|
||||
*/
|
||||
public <Q> List<T> queryClazzListByArgs(Q criteria) {
|
||||
QueryWrapper<T> predicate = CsMpQUtil.build(criteria);
|
||||
QueryWrapper<T> predicate = KitMpQUtil.build(criteria);
|
||||
return baseMapper.selectList(predicate);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public class CsMpServiceImpl<M extends CsMpMapper<T>, T> extends ServiceImpl<M,
|
||||
* @param targetClazz 目标类型
|
||||
*/
|
||||
public <G, Q> List<G> queryFeatureClazzListByArgs(Q criteria, Class<G> targetClazz) {
|
||||
QueryWrapper<T> predicate = CsMpQUtil.build(criteria);
|
||||
QueryWrapper<T> predicate = KitMpQUtil.build(criteria);
|
||||
List<T> data = baseMapper.selectList(predicate);
|
||||
return BeanUtil.copyToList(data, targetClazz);
|
||||
}
|
||||
@@ -194,12 +194,12 @@ public class CsMpServiceImpl<M extends CsMpMapper<T>, T> extends ServiceImpl<M,
|
||||
* @param wrapper 制造条件
|
||||
* @param pageable 分页参数
|
||||
*/
|
||||
public CsPageResult<T> queryClazzPageByArgs(LambdaQueryWrapper<T> wrapper, IPage<T> pageable) {
|
||||
public KitPageResult<T> queryClazzPageByArgs(LambdaQueryWrapper<T> wrapper, IPage<T> pageable) {
|
||||
if (wrapper == null) {
|
||||
wrapper = new LambdaQueryWrapper<>();
|
||||
}
|
||||
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
||||
return new CsPageResult<>(originPageData.getRecords(), originPageData.getTotal());
|
||||
return new KitPageResult<>(originPageData.getRecords(), originPageData.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -209,24 +209,24 @@ public class CsMpServiceImpl<M extends CsMpMapper<T>, T> extends ServiceImpl<M,
|
||||
* @param pageable 分页参数
|
||||
* @param targetClazz 目标类型
|
||||
*/
|
||||
public <G> CsPageResult<G> queryFeatureClazzPageByArgs(LambdaQueryWrapper<T> wrapper, IPage<T> pageable, Class<G> targetClazz) {
|
||||
public <G> KitPageResult<G> queryFeatureClazzPageByArgs(LambdaQueryWrapper<T> wrapper, IPage<T> pageable, Class<G> targetClazz) {
|
||||
if (wrapper == null) {
|
||||
wrapper = new LambdaQueryWrapper<>();
|
||||
}
|
||||
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
||||
return new CsPageResult<>(BeanUtil.copyToList(originPageData.getRecords(), targetClazz), originPageData.getTotal());
|
||||
return new KitPageResult<>(BeanUtil.copyToList(originPageData.getRecords(), targetClazz), originPageData.getTotal());
|
||||
}
|
||||
|
||||
public <G, Q> CsPageResult<G> queryFeatureClazzPageByArgs(Q criteria, IPage<T> pageable, Class<G> targetClazz) {
|
||||
QueryWrapper<T> wrapper = CsMpQUtil.build(criteria);
|
||||
public <G, Q> KitPageResult<G> queryFeatureClazzPageByArgs(Q criteria, IPage<T> pageable, Class<G> targetClazz) {
|
||||
QueryWrapper<T> wrapper = KitMpQUtil.build(criteria);
|
||||
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
||||
return new CsPageResult<>(BeanUtil.copyToList(originPageData.getRecords(), targetClazz), originPageData.getTotal());
|
||||
return new KitPageResult<>(BeanUtil.copyToList(originPageData.getRecords(), targetClazz), originPageData.getTotal());
|
||||
}
|
||||
|
||||
public <Q> CsPageResult<T> queryClazzPageByArgs(Q criteria, IPage<T> pageable) {
|
||||
QueryWrapper<T> wrapper = CsMpQUtil.build(criteria);
|
||||
public <Q> KitPageResult<T> queryClazzPageByArgs(Q criteria, IPage<T> pageable) {
|
||||
QueryWrapper<T> wrapper = KitMpQUtil.build(criteria);
|
||||
IPage<T> originPageData = baseMapper.selectPage(pageable, wrapper);
|
||||
return new CsPageResult<>(originPageData.getRecords(), originPageData.getTotal());
|
||||
return new KitPageResult<>(originPageData.getRecords(), originPageData.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
+2
-2
@@ -16,13 +16,13 @@
|
||||
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CaptchaModel extends CsObject {
|
||||
public class CaptchaModel extends KitObject {
|
||||
/**
|
||||
* 验证码有效时间, 单位: 秒
|
||||
*/
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -25,6 +25,6 @@ import lombok.Setter;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ContentRsaEncodeSettingModel extends CsObject {
|
||||
public class ContentRsaEncodeSettingModel extends KitObject {
|
||||
private String privateKey;
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -25,7 +25,7 @@ import lombok.Setter;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class JwtAuthSettingModel extends CsObject {
|
||||
public class JwtAuthSettingModel extends KitObject {
|
||||
/**
|
||||
* 必须使用最少88位的Base64对该令牌进行编码
|
||||
*/
|
||||
|
||||
+2
-2
@@ -16,13 +16,13 @@
|
||||
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class OSSConfigModel extends CsObject {
|
||||
public class OSSConfigModel extends KitObject {
|
||||
/**
|
||||
* 服务地址
|
||||
*/
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -28,7 +28,7 @@ import lombok.Setter;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class ThreadPoolSettingModel extends CsObject {
|
||||
public class ThreadPoolSettingModel extends KitObject {
|
||||
/**
|
||||
* 核心线程池大小
|
||||
*/
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.odboy.base.CsObject;
|
||||
import cn.odboy.base.KitObject;
|
||||
import cn.odboy.constant.CaptchaCodeEnum;
|
||||
import cn.odboy.framework.exception.BadRequestException;
|
||||
import com.wf.captcha.*;
|
||||
@@ -34,7 +34,7 @@ import java.awt.*;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserLoginCaptchaSettingModel extends CsObject {
|
||||
public class UserLoginCaptchaSettingModel extends KitObject {
|
||||
private CaptchaCodeEnum codeType;
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
|
||||
package cn.odboy.framework.properties.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@@ -27,7 +27,7 @@ import lombok.Setter;
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserLoginSettingModel extends CsObject {
|
||||
public class UserLoginSettingModel extends KitObject {
|
||||
/**
|
||||
* 账号单用户 登录
|
||||
*/
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
|
||||
package cn.odboy.framework.quartz.core;
|
||||
|
||||
import cn.odboy.framework.context.CsSpringBeanHolder;
|
||||
import cn.odboy.framework.context.KitSpringBeanHolder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
@@ -34,7 +34,7 @@ public class QuartzRunnable implements Callable<Object> {
|
||||
private final String params;
|
||||
|
||||
public QuartzRunnable(String beanName, String methodName, String params) throws NoSuchMethodException, SecurityException {
|
||||
this.target = CsSpringBeanHolder.getBean(beanName);
|
||||
this.target = KitSpringBeanHolder.getBean(beanName);
|
||||
this.params = params;
|
||||
if (StringUtils.isNotBlank(params)) {
|
||||
this.method = target.getClass().getDeclaredMethod(methodName, String.class);
|
||||
|
||||
+3
-3
@@ -34,12 +34,12 @@ import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
@SuppressWarnings({"unchecked", "all"})
|
||||
public class CsRedisHelper {
|
||||
private static final Logger log = LoggerFactory.getLogger(CsRedisHelper.class);
|
||||
public class KitRedisHelper {
|
||||
private static final Logger log = LoggerFactory.getLogger(KitRedisHelper.class);
|
||||
|
||||
private RedisTemplate<Object, Object> redisTemplate;
|
||||
|
||||
public CsRedisHelper(RedisTemplate<Object, Object> redisTemplate) {
|
||||
public KitRedisHelper(RedisTemplate<Object, Object> redisTemplate) {
|
||||
this.redisTemplate = redisTemplate;
|
||||
this.redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
this.redisTemplate.setHashKeySerializer(new StringRedisSerializer());
|
||||
+1
-1
@@ -53,7 +53,7 @@ public class ConfigurerAdapter implements WebMvcConfigurer {
|
||||
@Autowired
|
||||
private DateStringToDateConverter dateStringToDateConverter;
|
||||
@Autowired
|
||||
private CsFileLocalUploadHelper fileUploadPathHelper;
|
||||
private KitFileLocalUploadHelper fileUploadPathHelper;
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import org.springframework.stereotype.Component;
|
||||
* @author odboy
|
||||
*/
|
||||
@Component
|
||||
public class CsFileLocalUploadHelper {
|
||||
public class KitFileLocalUploadHelper {
|
||||
/**
|
||||
* 单位MB
|
||||
*/
|
||||
+7
-7
@@ -29,20 +29,20 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* @date 2025-07-24
|
||||
*/
|
||||
@Slf4j
|
||||
public class CsWsClientManager {
|
||||
public class KitWsClientManager {
|
||||
/**
|
||||
* concurrent包的线程安全Map, 用来存放每个客户端对应的MyWebSocket对象。(分布式必出问题)
|
||||
*/
|
||||
private static final Map<String, CsWsServer> clientMap = new ConcurrentHashMap<>();
|
||||
private static final Map<String, KitWsServer> clientMap = new ConcurrentHashMap<>();
|
||||
|
||||
public static void addClient(String sid, CsWsServer csWsServer) {
|
||||
public static void addClient(String sid, KitWsServer wsServer) {
|
||||
// 如果存在就先删除一个, 防止重复推送消息
|
||||
removeClient(sid);
|
||||
clientMap.put(sid, csWsServer);
|
||||
clientMap.put(sid, wsServer);
|
||||
}
|
||||
|
||||
public static void removeClient(String sid) {
|
||||
CsWsServer wsServer = clientMap.get(sid);
|
||||
KitWsServer wsServer = clientMap.get(sid);
|
||||
if (wsServer != null) {
|
||||
try {
|
||||
log.info("关闭session, sid={}", sid);
|
||||
@@ -54,11 +54,11 @@ public class CsWsClientManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static Collection<CsWsServer> getAllClient() {
|
||||
public static Collection<KitWsServer> getAllClient() {
|
||||
return clientMap.values();
|
||||
}
|
||||
|
||||
public static CsWsServer getClientBySid(String sid) {
|
||||
public static KitWsServer getClientBySid(String sid) {
|
||||
return clientMap.get(sid);
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -16,17 +16,17 @@
|
||||
|
||||
package cn.odboy.framework.websocket.context;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class CsWsMessage extends CsObject {
|
||||
public class KitWsMessage extends KitObject {
|
||||
private String bizCode;
|
||||
private String data;
|
||||
|
||||
public CsWsMessage(String bizCode, String data) {
|
||||
public KitWsMessage(String bizCode, String data) {
|
||||
this.bizCode = bizCode;
|
||||
this.data = data;
|
||||
}
|
||||
+10
-10
@@ -31,7 +31,7 @@ import java.util.Objects;
|
||||
@Component
|
||||
@ServerEndpoint("/websocket/{sid}")
|
||||
@Getter
|
||||
public class CsWsServer {
|
||||
public class KitWsServer {
|
||||
/**
|
||||
* 与某个客户端的连接会话, 需要通过它来给客户端发送数据
|
||||
*/
|
||||
@@ -49,7 +49,7 @@ public class CsWsServer {
|
||||
this.session = session;
|
||||
// {username}#{bizCode}#{contextParams}
|
||||
this.sid = sid;
|
||||
CsWsClientManager.addClient(sid, this);
|
||||
KitWsClientManager.addClient(sid, this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,7 +59,7 @@ public class CsWsServer {
|
||||
*/
|
||||
@OnMessage
|
||||
public void onMessage(String message, Session session) {
|
||||
CsWsMessage wsMessage = JSON.parseObject(message, CsWsMessage.class);
|
||||
KitWsMessage wsMessage = JSON.parseObject(message, KitWsMessage.class);
|
||||
String bizCode = wsMessage.getBizCode();
|
||||
Object data = wsMessage.getData();
|
||||
log.info("收到来 sid={} 的信息: message={}, bizCode={}, data={}", sid, message, bizCode, JSON.toJSONString(data));
|
||||
@@ -71,7 +71,7 @@ public class CsWsServer {
|
||||
@OnClose
|
||||
public void onClose() {
|
||||
try {
|
||||
CsWsClientManager.removeClient(this.sid);
|
||||
KitWsClientManager.removeClient(this.sid);
|
||||
} catch (Exception e) {
|
||||
log.error("WebSocket onClose error, sid={}", this.sid, e);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class CsWsServer {
|
||||
public void onError(Session session, Throwable error) {
|
||||
// log.error("WebSocket sid={} 发生错误", this.sid, error);
|
||||
try {
|
||||
CsWsClientManager.removeClient(this.sid);
|
||||
KitWsClientManager.removeClient(this.sid);
|
||||
} catch (Exception e) {
|
||||
log.error("WebSocket onClose error, sid={}", this.sid, e);
|
||||
}
|
||||
@@ -97,14 +97,14 @@ public class CsWsServer {
|
||||
/**
|
||||
* 精准推送消息
|
||||
*/
|
||||
public void sendMessage(CsWsMessage message, @PathParam("sid") String sid) {
|
||||
public void sendMessage(KitWsMessage message, @PathParam("sid") String sid) {
|
||||
String body = JSON.toJSONString(message);
|
||||
// log.info("推送消息到{}, 推送内容:{}", sid, message);
|
||||
try {
|
||||
if (sid == null) {
|
||||
sendToAll(body);
|
||||
} else {
|
||||
CsWsServer wsClient = CsWsClientManager.getClientBySid(sid);
|
||||
KitWsServer wsClient = KitWsClientManager.getClientBySid(sid);
|
||||
if (wsClient != null) {
|
||||
wsClient.innerSendMessage(body);
|
||||
}
|
||||
@@ -117,12 +117,12 @@ public class CsWsServer {
|
||||
* 群发消息
|
||||
*/
|
||||
public void sendToAll(String message) {
|
||||
for (CsWsServer item : CsWsClientManager.getAllClient()) {
|
||||
for (KitWsServer item : KitWsClientManager.getAllClient()) {
|
||||
try {
|
||||
item.innerSendMessage(message);
|
||||
} catch (IOException e) {
|
||||
log.error("发送消息给 sid={} 失败", item.sid, e);
|
||||
CsWsClientManager.removeClient(item.sid);
|
||||
KitWsClientManager.removeClient(item.sid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class CsWsServer {
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
CsWsServer that = (CsWsServer)o;
|
||||
KitWsServer that = (KitWsServer)o;
|
||||
return Objects.equals(session, that.session) && Objects.equals(sid, that.sid);
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,13 +16,13 @@
|
||||
|
||||
package cn.odboy.framework.websocket.model;
|
||||
|
||||
import cn.odboy.base.CsObject;
|
||||
import cn.odboy.base.KitObject;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class WsSidVo extends CsObject {
|
||||
public class WsSidVo extends KitObject {
|
||||
private String username;
|
||||
private String bizCode;
|
||||
private String param;
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ import java.util.*;
|
||||
* 匿名标记工具
|
||||
*/
|
||||
@UtilityClass
|
||||
public class CsAnonTagUtil {
|
||||
public class KitAnonTagUtil {
|
||||
|
||||
/**
|
||||
* 获取匿名标记的URL
|
||||
+1
-1
@@ -29,7 +29,7 @@ import java.nio.charset.StandardCharsets;
|
||||
* @date 2022-11-16
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsBase64SecretUtil {
|
||||
public final class KitBase64SecretUtil {
|
||||
|
||||
public static String build() {
|
||||
// 128位uuid
|
||||
+1
-1
@@ -26,7 +26,7 @@ import java.math.RoundingMode;
|
||||
* 计算类
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsBigDecimalUtil {
|
||||
public final class KitBigDecimalUtil {
|
||||
|
||||
/**
|
||||
* 将对象转换为 BigDecimal
|
||||
+1
-1
@@ -30,7 +30,7 @@ import java.net.UnknownHostException;
|
||||
*/
|
||||
@Slf4j
|
||||
@UtilityClass
|
||||
public final class CsBrowserUtil {
|
||||
public final class KitBrowserUtil {
|
||||
private static final String UNKNOWN = "unknown";
|
||||
|
||||
/**
|
||||
+1
-1
@@ -27,7 +27,7 @@ import java.util.List;
|
||||
* 类 相关
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsClassUtil {
|
||||
public final class KitClassUtil {
|
||||
@SuppressWarnings({"unchecked", "all"})
|
||||
public static List<Field> getAllFields(Class clazz, List<Field> fields) {
|
||||
if (clazz != null) {
|
||||
+1
-1
@@ -25,7 +25,7 @@ import java.io.Closeable;
|
||||
* 用于关闭各种连接, 缺啥补啥
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsCloseUtil {
|
||||
public final class KitCloseUtil {
|
||||
|
||||
public static void close(Closeable closeable) {
|
||||
if (null != closeable) {
|
||||
+14
-14
@@ -16,7 +16,7 @@
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.odboy.base.CsSelectOptionVo;
|
||||
import cn.odboy.base.KitSelectOptionVo;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
@@ -35,7 +35,7 @@ import java.util.stream.Collectors;
|
||||
* @date 2022-11-09
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsCollUtil extends cn.hutool.core.collection.CollUtil {
|
||||
public final class KitCollUtil extends cn.hutool.core.collection.CollUtil {
|
||||
private static <T, K> Predicate<T> distinctPredicate(Function<? super T, ? extends K> keyMapper) {
|
||||
Map<Object, Boolean> map = new HashMap<>(3);
|
||||
return (t) -> null == map.putIfAbsent(keyMapper.apply(t), true);
|
||||
@@ -107,7 +107,7 @@ public final class CsCollUtil extends cn.hutool.core.collection.CollUtil {
|
||||
* @return /
|
||||
*/
|
||||
public static Double streamDoubleAdd(List<Double> data) {
|
||||
if (CsCollUtil.isNotEmpty(data)) {
|
||||
if (KitCollUtil.isNotEmpty(data)) {
|
||||
return data.stream().filter(Objects::nonNull).reduce(Double::sum).orElse(0.0);
|
||||
}
|
||||
return 0.0;
|
||||
@@ -122,7 +122,7 @@ public final class CsCollUtil extends cn.hutool.core.collection.CollUtil {
|
||||
* @return /
|
||||
*/
|
||||
public static BigDecimal streamBigDecimalAdd(List<BigDecimal> data) {
|
||||
if (CsCollUtil.isNotEmpty(data)) {
|
||||
if (KitCollUtil.isNotEmpty(data)) {
|
||||
return data.stream().filter(Objects::nonNull).reduce(BigDecimal::add).orElse(BigDecimal.ZERO);
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
@@ -189,25 +189,25 @@ public final class CsCollUtil extends cn.hutool.core.collection.CollUtil {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<CsSelectOptionVo> testData = new ArrayList<>();
|
||||
CsSelectOptionVo selectOption1 = CsSelectOptionVo.builder().label("苹果").value("apple").build();
|
||||
CsSelectOptionVo selectOption2 = CsSelectOptionVo.builder().label("苹果").value("apple").build();
|
||||
CsSelectOptionVo selectOption3 = CsSelectOptionVo.builder().label("香蕉").value("banana").build();
|
||||
CsSelectOptionVo selectOption4 = CsSelectOptionVo.builder().label("猫").value("cat").build();
|
||||
List<KitSelectOptionVo> testData = new ArrayList<>();
|
||||
KitSelectOptionVo selectOption1 = KitSelectOptionVo.builder().label("苹果").value("apple").build();
|
||||
KitSelectOptionVo selectOption2 = KitSelectOptionVo.builder().label("苹果").value("apple").build();
|
||||
KitSelectOptionVo selectOption3 = KitSelectOptionVo.builder().label("香蕉").value("banana").build();
|
||||
KitSelectOptionVo selectOption4 = KitSelectOptionVo.builder().label("猫").value("cat").build();
|
||||
testData.add(selectOption1);
|
||||
testData.add(selectOption2);
|
||||
testData.add(selectOption3);
|
||||
testData.add(selectOption4);
|
||||
List<CsSelectOptionVo> selectOptions1 = CsCollUtil.streamAscSort(testData, CsSelectOptionVo::getValue);
|
||||
List<KitSelectOptionVo> selectOptions1 = KitCollUtil.streamAscSort(testData, KitSelectOptionVo::getValue);
|
||||
System.out.println(JSON.toJSONString(selectOptions1));
|
||||
List<CsSelectOptionVo> selectOptions2 = CsCollUtil.streamDescSort(testData, CsSelectOptionVo::getValue);
|
||||
List<KitSelectOptionVo> selectOptions2 = KitCollUtil.streamDescSort(testData, KitSelectOptionVo::getValue);
|
||||
System.out.println(JSON.toJSONString(selectOptions2));
|
||||
List<CsSelectOptionVo> selectOptions3 = CsCollUtil.streamDistinct(testData, CsSelectOptionVo::getValue);
|
||||
List<KitSelectOptionVo> selectOptions3 = KitCollUtil.streamDistinct(testData, KitSelectOptionVo::getValue);
|
||||
System.out.println(JSON.toJSONString(selectOptions3));
|
||||
Map<String, String> selectMap1 = CsCollUtil.streamToMap(testData, CsSelectOptionVo::getValue, CsSelectOptionVo::getLabel);
|
||||
Map<String, String> selectMap1 = KitCollUtil.streamToMap(testData, KitSelectOptionVo::getValue, KitSelectOptionVo::getLabel);
|
||||
System.out.println(JSON.toJSONString(selectMap1));
|
||||
// 这只是一个示范
|
||||
BigDecimal total1 = CsCollUtil.streamBigDecimalAdd(testData, "value");
|
||||
BigDecimal total1 = KitCollUtil.streamBigDecimalAdd(testData, "value");
|
||||
System.out.println(total1);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -29,7 +29,7 @@ import java.util.Date;
|
||||
* @date 2025-10-01
|
||||
*/
|
||||
@UtilityClass
|
||||
public class CsDateUtil {
|
||||
public class KitDateUtil {
|
||||
/**
|
||||
* 获取当前时间毫秒数
|
||||
*
|
||||
+1
-1
@@ -29,7 +29,7 @@ import java.nio.charset.StandardCharsets;
|
||||
* DES加密
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsDesEncryptUtil {
|
||||
public final class KitDesEncryptUtil {
|
||||
|
||||
private static final String STR_PARAM = "Passw0rd";
|
||||
private static final IvParameterSpec IV = new IvParameterSpec(STR_PARAM.getBytes(StandardCharsets.UTF_8));
|
||||
+4
-4
@@ -26,7 +26,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
* @author odboy
|
||||
* @date 2025-04-05
|
||||
*/
|
||||
public final class CsDistributedIdUtil {
|
||||
public final class KitDistributedIdUtil {
|
||||
/**
|
||||
* 起始毫秒时间戳, 2020-12-30
|
||||
*/
|
||||
@@ -96,7 +96,7 @@ public final class CsDistributedIdUtil {
|
||||
* @param workerIdBits 机器 ID 所占位数
|
||||
* @param sequenceBits 序列号所占位数
|
||||
*/
|
||||
public CsDistributedIdUtil(long dataCenterId, long workerId, long dataCenterIdBits, long workerIdBits, long sequenceBits) {
|
||||
public KitDistributedIdUtil(long dataCenterId, long workerId, long dataCenterIdBits, long workerIdBits, long sequenceBits) {
|
||||
this.dataCenterIdBits = dataCenterIdBits;
|
||||
this.workerIdBits = workerIdBits;
|
||||
this.sequenceBits = sequenceBits;
|
||||
@@ -138,7 +138,7 @@ public final class CsDistributedIdUtil {
|
||||
new Thread(() -> {
|
||||
long id = Thread.currentThread().getId();
|
||||
for (int j = 0; j < 20; j++) {
|
||||
System.out.println(id + " - " + CsDistributedIdUtil.fastNextId());
|
||||
System.out.println(id + " - " + KitDistributedIdUtil.fastNextId());
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
@@ -192,6 +192,6 @@ public final class CsDistributedIdUtil {
|
||||
* 单例实例持有者类
|
||||
*/
|
||||
private static class InstanceHolder {
|
||||
private static final CsDistributedIdUtil INSTANCE = new CsDistributedIdUtil(20, 12, 5, 5, 12);
|
||||
private static final KitDistributedIdUtil INSTANCE = new KitDistributedIdUtil(20, 12, 5, 5, 12);
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -49,7 +49,7 @@ import static cn.odboy.constant.SystemConst.*;
|
||||
*/
|
||||
@Slf4j
|
||||
@UtilityClass
|
||||
public final class CsFileUtil extends cn.hutool.core.io.FileUtil {
|
||||
public final class KitFileUtil extends cn.hutool.core.io.FileUtil {
|
||||
|
||||
/**
|
||||
* 系统临时目录
|
||||
@@ -140,8 +140,8 @@ public final class CsFileUtil extends cn.hutool.core.io.FileUtil {
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
} finally {
|
||||
CsCloseUtil.close(os);
|
||||
CsCloseUtil.close(ins);
|
||||
KitCloseUtil.close(os);
|
||||
KitCloseUtil.close(ins);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
@@ -285,7 +285,7 @@ public final class CsFileUtil extends cn.hutool.core.io.FileUtil {
|
||||
log.error(e.getMessage(), e);
|
||||
return null;
|
||||
} finally {
|
||||
CsCloseUtil.close(in);
|
||||
KitCloseUtil.close(in);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
+3
-3
@@ -16,7 +16,7 @@
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.odboy.framework.context.CsSpringBeanHolder;
|
||||
import cn.odboy.framework.context.KitSpringBeanHolder;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.dreamlu.mica.ip2region.core.Ip2regionSearcher;
|
||||
import net.dreamlu.mica.ip2region.core.IpInfo;
|
||||
@@ -29,11 +29,11 @@ import java.util.Enumeration;
|
||||
* IP地址 相关
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsIPUtil {
|
||||
public final class KitIPUtil {
|
||||
/**
|
||||
* 注入bean
|
||||
*/
|
||||
private final static Ip2regionSearcher IP_SEARCHER = CsSpringBeanHolder.getBean(Ip2regionSearcher.class);
|
||||
private final static Ip2regionSearcher IP_SEARCHER = KitSpringBeanHolder.getBean(Ip2regionSearcher.class);
|
||||
|
||||
/**
|
||||
* 根据ip获取详细地址
|
||||
+3
-3
@@ -30,7 +30,7 @@ import java.util.Map;
|
||||
* @date 2024-10-01
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsJsonUtil {
|
||||
public final class KitJsonUtil {
|
||||
public static <K, V> Map<K, V> toMap(String jsonStr, Class<K> kClass, Class<V> vClass) {
|
||||
return JSON.parseObject(jsonStr, new TypeReference<>() {
|
||||
});
|
||||
@@ -43,8 +43,8 @@ public final class CsJsonUtil {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String mapStr = "{\"key1\":\"value1\", \"key2\":\"value2\"}";
|
||||
System.err.println(CsJsonUtil.toMap(mapStr, String.class, String.class));
|
||||
System.err.println(KitJsonUtil.toMap(mapStr, String.class, String.class));
|
||||
String listStr = "[\"value1\", \"value2\"]";
|
||||
System.err.println(CsJsonUtil.toList(listStr, String.class));
|
||||
System.err.println(KitJsonUtil.toList(listStr, String.class));
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -17,7 +17,7 @@
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.odboy.base.CsBaseUserTimeTb;
|
||||
import cn.odboy.base.KitBaseUserTimeTb;
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -32,7 +32,7 @@ import java.util.stream.Collectors;
|
||||
* @date 2024-10-01
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsListUtil {
|
||||
public final class KitListUtil {
|
||||
/**
|
||||
* 根据对象T的属性去重
|
||||
*
|
||||
@@ -48,10 +48,10 @@ public final class CsListUtil {
|
||||
* User> userMap = users.stream().collect(Collectors.toMap(User::getName, user -> user, (existing, replacement) -> existing));
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
List<CsBaseUserTimeTb> entities = new ArrayList<>();
|
||||
List<KitBaseUserTimeTb> entities = new ArrayList<>();
|
||||
int total = 50;
|
||||
for (int i = 0; i < total; i++) {
|
||||
CsBaseUserTimeTb entity = new CsBaseUserTimeTb();
|
||||
KitBaseUserTimeTb entity = new KitBaseUserTimeTb();
|
||||
if (i % 2 == 0) {
|
||||
entity.setCreateBy("odboy");
|
||||
} else {
|
||||
@@ -62,7 +62,7 @@ public final class CsListUtil {
|
||||
entity.setUpdateTime(DateTime.now().toTimestamp());
|
||||
entities.add(entity);
|
||||
}
|
||||
List<CsBaseUserTimeTb> entities1 = CsListUtil.distinctByArgs(entities, CsBaseUserTimeTb::getCreateBy);
|
||||
List<KitBaseUserTimeTb> entities1 = KitListUtil.distinctByArgs(entities, KitBaseUserTimeTb::getCreateBy);
|
||||
System.err.println(entities1);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -25,7 +25,7 @@ import lombok.experimental.UtilityClass;
|
||||
* @date 2025-01-13
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsLogFmtUtil {
|
||||
public final class KitLogFmtUtil {
|
||||
/**
|
||||
* 替换字符串中的占位符 {} 为传入的参数
|
||||
*
|
||||
+12
-12
@@ -16,7 +16,7 @@
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import cn.odboy.base.CsPageResult;
|
||||
import cn.odboy.base.KitPageResult;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -32,7 +32,7 @@ import java.util.List;
|
||||
* @author odboy
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsPageUtil extends cn.hutool.core.util.PageUtil {
|
||||
public final class KitPageUtil extends cn.hutool.core.util.PageUtil {
|
||||
|
||||
/**
|
||||
* List 分页
|
||||
@@ -53,36 +53,36 @@ public final class CsPageUtil extends cn.hutool.core.util.PageUtil {
|
||||
/**
|
||||
* Page 数据处理
|
||||
*/
|
||||
public static <T> CsPageResult<T> toPage(IPage<T> page) {
|
||||
return new CsPageResult<>(page.getRecords(), page.getTotal());
|
||||
public static <T> KitPageResult<T> toPage(IPage<T> page) {
|
||||
return new KitPageResult<>(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*/
|
||||
public static <T> CsPageResult<T> toPage(List<T> list) {
|
||||
return new CsPageResult<>(list, list.size());
|
||||
public static <T> KitPageResult<T> toPage(List<T> list) {
|
||||
return new KitPageResult<>(list, list.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回空数据
|
||||
*/
|
||||
public static <T> CsPageResult<T> emptyListData() {
|
||||
return new CsPageResult<>(new ArrayList<>(), 0);
|
||||
public static <T> KitPageResult<T> emptyListData() {
|
||||
return new KitPageResult<>(new ArrayList<>(), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回空数据
|
||||
*/
|
||||
public static <T> CsPageResult<T> emptyData() {
|
||||
return new CsPageResult<>(null, 0);
|
||||
public static <T> KitPageResult<T> emptyData() {
|
||||
return new KitPageResult<>(null, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*/
|
||||
public static <T> CsPageResult<T> toPage(List<T> list, long totalElements) {
|
||||
return new CsPageResult<>(list, totalElements);
|
||||
public static <T> KitPageResult<T> toPage(List<T> list, long totalElements) {
|
||||
return new KitPageResult<>(list, totalElements);
|
||||
}
|
||||
|
||||
public static <T> Page<T> getCount(BaseMapper<T> baseMapper) {
|
||||
+1
-1
@@ -31,7 +31,7 @@ import lombok.experimental.UtilityClass;
|
||||
* @date 2025-06-22
|
||||
*/
|
||||
@UtilityClass
|
||||
public class CsResourceTemplateUtil {
|
||||
public class KitResourceTemplateUtil {
|
||||
public static String render(String moduleName, String filename, Dict params) {
|
||||
String path = StrUtil.isBlank(moduleName) ? "template" : "template/" + moduleName;
|
||||
TemplateEngine engine = TemplateUtil.createEngine(new TemplateConfig(path, TemplateConfig.ResourceMode.CLASSPATH));
|
||||
+1
-1
@@ -32,7 +32,7 @@ import java.util.Set;
|
||||
* @author odboy
|
||||
* @date 2025-05-08
|
||||
*/
|
||||
public class CsReturnValueHandleUtil {
|
||||
public class KitReturnValueHandleUtil {
|
||||
public static Object getDefaultValue(ProceedingJoinPoint joinPoint) {
|
||||
MethodSignature signature = (MethodSignature)joinPoint.getSignature();
|
||||
Method method = signature.getMethod();
|
||||
+7
-7
@@ -31,7 +31,7 @@ import java.security.spec.X509EncodedKeySpec;
|
||||
* Rsa 工具类, 公钥私钥生成, 加解密
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsRsaEncryptUtil {
|
||||
public final class KitRsaEncryptUtil {
|
||||
|
||||
private static final String SRC = "123456";
|
||||
|
||||
@@ -52,12 +52,12 @@ public final class CsRsaEncryptUtil {
|
||||
*/
|
||||
private static void test1(RsaKeyPair keyPair) throws Exception {
|
||||
System.out.println("***************** 公钥加密私钥解密开始 *****************");
|
||||
String text1 = encryptByPublicKey(keyPair.getPublicKey(), CsRsaEncryptUtil.SRC);
|
||||
String text1 = encryptByPublicKey(keyPair.getPublicKey(), KitRsaEncryptUtil.SRC);
|
||||
String text2 = decryptByPrivateKey(keyPair.getPrivateKey(), text1);
|
||||
System.out.println("加密前:" + CsRsaEncryptUtil.SRC);
|
||||
System.out.println("加密前:" + KitRsaEncryptUtil.SRC);
|
||||
System.out.println("加密后:" + text1);
|
||||
System.out.println("解密后:" + text2);
|
||||
if (CsRsaEncryptUtil.SRC.equals(text2)) {
|
||||
if (KitRsaEncryptUtil.SRC.equals(text2)) {
|
||||
System.out.println("解密字符串和原始字符串一致, 解密成功");
|
||||
} else {
|
||||
System.out.println("解密字符串和原始字符串不一致,解密失败");
|
||||
@@ -72,12 +72,12 @@ public final class CsRsaEncryptUtil {
|
||||
*/
|
||||
private static void test2(RsaKeyPair keyPair) throws Exception {
|
||||
System.out.println("***************** 私钥加密公钥解密开始 *****************");
|
||||
String text1 = encryptByPrivateKey(keyPair.getPrivateKey(), CsRsaEncryptUtil.SRC);
|
||||
String text1 = encryptByPrivateKey(keyPair.getPrivateKey(), KitRsaEncryptUtil.SRC);
|
||||
String text2 = decryptByPublicKey(keyPair.getPublicKey(), text1);
|
||||
System.out.println("加密前:" + CsRsaEncryptUtil.SRC);
|
||||
System.out.println("加密前:" + KitRsaEncryptUtil.SRC);
|
||||
System.out.println("加密后:" + text1);
|
||||
System.out.println("解密后:" + text2);
|
||||
if (CsRsaEncryptUtil.SRC.equals(text2)) {
|
||||
if (KitRsaEncryptUtil.SRC.equals(text2)) {
|
||||
System.out.println("解密字符串和原始字符串一致,解密成功");
|
||||
} else {
|
||||
System.out.println("解密字符串和原始字符串不一致,解密失败");
|
||||
+1
-1
@@ -28,7 +28,7 @@ import java.util.Date;
|
||||
*/
|
||||
@Slf4j
|
||||
@UtilityClass
|
||||
public final class CsStringUtil {
|
||||
public final class KitStringUtil {
|
||||
|
||||
private static final char SEPARATOR = '_';
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ import oshi.hardware.CentralProcessor;
|
||||
* @author odboy
|
||||
* @date 2025-08-11
|
||||
*/
|
||||
public class CsSystemUtil {
|
||||
public class KitSystemUtil {
|
||||
public static int getCpuCount() {
|
||||
SystemInfo systemInfo = new SystemInfo();
|
||||
CentralProcessor processor = systemInfo.getHardware().getProcessor();
|
||||
+1
-1
@@ -34,7 +34,7 @@ import java.util.stream.Collectors;
|
||||
* @date 2025-01-15
|
||||
*/
|
||||
@UtilityClass
|
||||
public final class CsValidUtil {
|
||||
public final class KitValidUtil {
|
||||
private static final Validator VALIDATOR;
|
||||
|
||||
static {
|
||||
Reference in New Issue
Block a user