chore(build): 更新项目依赖版本并优化代码格式
- 升级 Spring Boot 父项目版本至 3.5.9 - 更新 MySQL 连接器版本至 9.4.0 - 更新 MyBatis-Plus 版本至 3.5.14 - 更新 Fastjson2 版本至 2.0.59 - 更新 Hutool 版本至 5.8.41 - 更新 JJWT 版本至 0.12.6 - 更新 Knife4j 版本至 4.5.0 - 更新 Undertow 版本至 2.3.20.Final - 更新 Oshi 版本至 6.6.5 - 更新 Guava 版本至 33.5.0-jre - 格式化注解文件中的代码缩进 - 移除多余的空行和注释格式调整
This commit is contained in:
@@ -25,8 +25,9 @@ import org.springframework.cache.annotation.EnableCaching;
|
||||
@EnableCaching
|
||||
@SpringBootApplication
|
||||
public class AppRun extends BootApplication {
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
SpringApplication springApplication = new SpringApplication(AppRun.class);
|
||||
inited(springApplication.run(args));
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
SpringApplication springApplication = new SpringApplication(AppRun.class);
|
||||
inited(springApplication.run(args));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,24 +23,25 @@ import java.util.List;
|
||||
* 代码生成入口
|
||||
*/
|
||||
public class GenCode {
|
||||
private static final String ADDR = "127.0.0.1";
|
||||
private static final Integer PORT = 23306;
|
||||
private static final String DATABASE_NAME = "cutejava";
|
||||
private static final String DATABASE_USER = "root";
|
||||
private static final String DATABASE_PWD = "kd123456";
|
||||
private static final String URL = String.format("jdbc:mysql://%s:%s/%s", ADDR, PORT, DATABASE_NAME);
|
||||
|
||||
public static void main(String[] args) {
|
||||
KitMpCmdGenUtil generator = new KitMpCmdGenUtil();
|
||||
generator.setDatabaseUrl(URL);
|
||||
generator.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
||||
generator.setDatabaseUsername(DATABASE_USER);
|
||||
generator.setDatabasePassword(DATABASE_PWD);
|
||||
genTaskCode(generator);
|
||||
}
|
||||
private static final String ADDR = "127.0.0.1";
|
||||
private static final Integer PORT = 23306;
|
||||
private static final String DATABASE_NAME = "cutejava";
|
||||
private static final String DATABASE_USER = "root";
|
||||
private static final String DATABASE_PWD = "kd123456";
|
||||
private static final String URL = String.format("jdbc:mysql://%s:%s/%s", ADDR, PORT, DATABASE_NAME);
|
||||
|
||||
private static void genTaskCode(KitMpCmdGenUtil generator) {
|
||||
generator.gen("task", "",
|
||||
List.of("task_instance_info", "task_instance_detail", "task_template_info", "task_instance_step_detail"));
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
KitMpCmdGenUtil generator = new KitMpCmdGenUtil();
|
||||
generator.setDatabaseUrl(URL);
|
||||
generator.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
||||
generator.setDatabaseUsername(DATABASE_USER);
|
||||
generator.setDatabasePassword(DATABASE_PWD);
|
||||
genTaskCode(generator);
|
||||
}
|
||||
|
||||
private static void genTaskCode(KitMpCmdGenUtil generator) {
|
||||
generator.gen("task", "",
|
||||
List.of("task_instance_info", "task_instance_detail", "task_template_info", "task_instance_step_detail"));
|
||||
}
|
||||
}
|
||||
|
||||
+17
-15
@@ -24,21 +24,23 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class HealthCheckPointer implements KitHealthCheckPointService {
|
||||
@Autowired private SystemDictMapper systemDictMapper;
|
||||
|
||||
/**
|
||||
* 系统准备就绪
|
||||
*/
|
||||
@Override
|
||||
public ResponseEntity<?> doReadiness() {
|
||||
return ResponseEntity.ok(null);
|
||||
}
|
||||
@Autowired
|
||||
private SystemDictMapper systemDictMapper;
|
||||
|
||||
/**
|
||||
* 系统是否正常
|
||||
*/
|
||||
@Override
|
||||
public ResponseEntity<?> doLiveness() {
|
||||
return ResponseEntity.ok(systemDictMapper.selectById(1));
|
||||
}
|
||||
/**
|
||||
* 系统准备就绪
|
||||
*/
|
||||
@Override
|
||||
public ResponseEntity<?> doReadiness() {
|
||||
return ResponseEntity.ok(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统是否正常
|
||||
*/
|
||||
@Override
|
||||
public ResponseEntity<?> doLiveness() {
|
||||
return ResponseEntity.ok(systemDictMapper.selectById(1));
|
||||
}
|
||||
}
|
||||
|
||||
+17
-15
@@ -28,24 +28,26 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class MyBatisMapperTests {
|
||||
@Autowired private SystemUserMapper systemUserMapper;
|
||||
|
||||
@Test
|
||||
public void testMapper1() {
|
||||
// SELECT * FROM system_user WHERE (create_time > '2025-08-18T14:48:18.400+0800');
|
||||
systemUserMapper.selectList(new LambdaQueryWrapper<SystemUserTb>().gt(SystemUserTb::getCreateTime, new Date()));
|
||||
@Autowired
|
||||
private SystemUserMapper systemUserMapper;
|
||||
|
||||
// SELECT * FROM system_user WHERE (create_time > '2025-08-18T14:50:16.786+0800');
|
||||
systemUserMapper.selectList(
|
||||
new LambdaQueryWrapper<SystemUserTb>().gt(SystemUserTb::getCreateTime, DateTime.now()));
|
||||
@Test
|
||||
public void testMapper1() {
|
||||
// SELECT * FROM system_user WHERE (create_time > '2025-08-18T14:48:18.400+0800');
|
||||
systemUserMapper.selectList(new LambdaQueryWrapper<SystemUserTb>().gt(SystemUserTb::getCreateTime, new Date()));
|
||||
|
||||
// SELECT * FROM system_user WHERE (create_time > '2025-08-18 14:53:46');
|
||||
systemUserMapper.selectList(new LambdaQueryWrapper<SystemUserTb>().gt(SystemUserTb::getCreateTime,
|
||||
DateUtil.formatDateTime(new Date())));
|
||||
// SELECT * FROM system_user WHERE (create_time > '2025-08-18T14:50:16.786+0800');
|
||||
systemUserMapper.selectList(
|
||||
new LambdaQueryWrapper<SystemUserTb>().gt(SystemUserTb::getCreateTime, DateTime.now()));
|
||||
|
||||
// SELECT * FROM system_user WHERE (create_time > '2025-08-18');
|
||||
systemUserMapper.selectList(
|
||||
new LambdaQueryWrapper<SystemUserTb>().gt(SystemUserTb::getCreateTime, DateUtil.formatDate(new Date())));
|
||||
}
|
||||
// SELECT * FROM system_user WHERE (create_time > '2025-08-18 14:53:46');
|
||||
systemUserMapper.selectList(new LambdaQueryWrapper<SystemUserTb>().gt(SystemUserTb::getCreateTime,
|
||||
DateUtil.formatDateTime(new Date())));
|
||||
|
||||
// SELECT * FROM system_user WHERE (create_time > '2025-08-18');
|
||||
systemUserMapper.selectList(
|
||||
new LambdaQueryWrapper<SystemUserTb>().gt(SystemUserTb::getCreateTime, DateUtil.formatDate(new Date())));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+28
-25
@@ -30,35 +30,38 @@ import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class SystemApplicationTests {
|
||||
@Autowired private PasswordEncoder passwordEncoder;
|
||||
@Autowired private SystemUserService systemUserService;
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
SystemDeptTb systemDept = new SystemDeptTb();
|
||||
systemDept.setId(2L);
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder;
|
||||
@Autowired
|
||||
private SystemUserService systemUserService;
|
||||
|
||||
SystemJobTb systemJob = new SystemJobTb();
|
||||
systemJob.setId(11L);
|
||||
Set<SystemJobTb> systemJobs = CollUtil.newHashSet(systemJob);
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
SystemDeptTb systemDept = new SystemDeptTb();
|
||||
systemDept.setId(2L);
|
||||
|
||||
SystemRoleTb systemRole = new SystemRoleTb();
|
||||
systemRole.setId(2L);
|
||||
Set<SystemRoleTb> systemRoles = CollUtil.newHashSet(systemRole);
|
||||
SystemJobTb systemJob = new SystemJobTb();
|
||||
systemJob.setId(11L);
|
||||
Set<SystemJobTb> systemJobs = CollUtil.newHashSet(systemJob);
|
||||
|
||||
String pwd = passwordEncoder.encode("123456");
|
||||
for (int i = 100; i < 200; i++) {
|
||||
SystemUserVo systemUser = new SystemUserVo();
|
||||
systemUser.setDept(systemDept);
|
||||
systemUser.setJobs(systemJobs);
|
||||
systemUser.setRoles(systemRoles);
|
||||
systemUser.setUsername("odboy" + i);
|
||||
systemUser.setEmail("1943815" + i + "@qq.com");
|
||||
systemUser.setPhone("18797874" + i);
|
||||
systemUser.setPassword(pwd);
|
||||
systemUser.setEnabled(true);
|
||||
systemUserService.saveUser(systemUser);
|
||||
}
|
||||
SystemRoleTb systemRole = new SystemRoleTb();
|
||||
systemRole.setId(2L);
|
||||
Set<SystemRoleTb> systemRoles = CollUtil.newHashSet(systemRole);
|
||||
|
||||
String pwd = passwordEncoder.encode("123456");
|
||||
for (int i = 100; i < 200; i++) {
|
||||
SystemUserVo systemUser = new SystemUserVo();
|
||||
systemUser.setDept(systemDept);
|
||||
systemUser.setJobs(systemJobs);
|
||||
systemUser.setRoles(systemRoles);
|
||||
systemUser.setUsername("odboy" + i);
|
||||
systemUser.setEmail("1943815" + i + "@qq.com");
|
||||
systemUser.setPhone("18797874" + i);
|
||||
systemUser.setPassword(pwd);
|
||||
systemUser.setEnabled(true);
|
||||
systemUserService.saveUser(systemUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+27
-27
@@ -16,41 +16,41 @@
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static cn.odboy.util.KitDesEncryptUtil.desDecrypt;
|
||||
import static cn.odboy.util.KitDesEncryptUtil.desEncrypt;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class KitDesEncryptUtilTest {
|
||||
|
||||
@SneakyThrows
|
||||
public static void main(String[] args) {
|
||||
System.err.println(desEncrypt("abc12345678"));
|
||||
}
|
||||
@SneakyThrows
|
||||
public static void main(String[] args) {
|
||||
System.err.println(desEncrypt("abc12345678"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 对称加密
|
||||
*/
|
||||
@Test
|
||||
public void testDesEncrypt() {
|
||||
try {
|
||||
assertEquals("7772841DC6099402", desEncrypt("abc12345678"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
/**
|
||||
* 对称加密
|
||||
*/
|
||||
@Test
|
||||
public void testDesEncrypt() {
|
||||
try {
|
||||
assertEquals("7772841DC6099402", desEncrypt("abc12345678"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对称解密
|
||||
*/
|
||||
@Test
|
||||
public void testDesDecrypt() {
|
||||
try {
|
||||
assertEquals("abc12345678", desDecrypt("7772841DC6099402"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
/**
|
||||
* 对称解密
|
||||
*/
|
||||
@Test
|
||||
public void testDesDecrypt() {
|
||||
try {
|
||||
assertEquals("abc12345678", desDecrypt("7772841DC6099402"));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+25
-25
@@ -16,40 +16,40 @@
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
|
||||
import static cn.odboy.util.KitFileUtil.getPrefix;
|
||||
import static cn.odboy.util.KitFileUtil.getSize;
|
||||
import static cn.odboy.util.KitFileUtil.getSuffix;
|
||||
import static cn.odboy.util.KitFileUtil.toFile;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.mock.web.MockMultipartFile;
|
||||
|
||||
public class KitFileUtilTest {
|
||||
|
||||
@Test
|
||||
public void testToFile() {
|
||||
long retval = toFile(new MockMultipartFile("foo", (byte[])null)).getTotalSpace();
|
||||
assertEquals(500695072768L, retval);
|
||||
}
|
||||
@Test
|
||||
public void testToFile() {
|
||||
long retval = toFile(new MockMultipartFile("foo", (byte[]) null)).getTotalSpace();
|
||||
assertEquals(500695072768L, retval);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetExtensionName() {
|
||||
assertEquals("foo", getSuffix("foo"));
|
||||
assertEquals("exe", getSuffix("bar.exe"));
|
||||
}
|
||||
@Test
|
||||
public void testGetExtensionName() {
|
||||
assertEquals("foo", getSuffix("foo"));
|
||||
assertEquals("exe", getSuffix("bar.exe"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetFileNameNoEx() {
|
||||
assertEquals("foo", getPrefix("foo"));
|
||||
assertEquals("bar", getPrefix("bar.txt"));
|
||||
}
|
||||
@Test
|
||||
public void testGetFileNameNoEx() {
|
||||
assertEquals("foo", getPrefix("foo"));
|
||||
assertEquals("bar", getPrefix("bar.txt"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSize() {
|
||||
assertEquals("1000B ", getSize(1000));
|
||||
assertEquals("1.00KB ", getSize(1024));
|
||||
assertEquals("1.00MB ", getSize(1048576));
|
||||
assertEquals("1.00GB ", getSize(1073741824));
|
||||
}
|
||||
@Test
|
||||
public void testGetSize() {
|
||||
assertEquals("1000B ", getSize(1000));
|
||||
assertEquals("1.00KB ", getSize(1024));
|
||||
assertEquals("1.00MB ", getSize(1048576));
|
||||
assertEquals("1.00GB ", getSize(1073741824));
|
||||
}
|
||||
}
|
||||
|
||||
+31
-31
@@ -16,12 +16,6 @@
|
||||
|
||||
package cn.odboy.util;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
|
||||
import static cn.odboy.util.KitStringUtil.getWeekDay;
|
||||
import static cn.odboy.util.KitStringUtil.toCamelCase;
|
||||
import static cn.odboy.util.KitStringUtil.toCapitalizeCamelCase;
|
||||
@@ -29,35 +23,41 @@ import static cn.odboy.util.KitStringUtil.toUnderScoreCase;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
|
||||
public class KitStringUtilTest {
|
||||
|
||||
@Test
|
||||
public void testToCamelCase() {
|
||||
assertNull(toCamelCase(null));
|
||||
}
|
||||
@Test
|
||||
public void testToCamelCase() {
|
||||
assertNull(toCamelCase(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToCapitalizeCamelCase() {
|
||||
assertNull(KitStringUtil.toCapitalizeCamelCase(null));
|
||||
assertEquals("HelloWorld", toCapitalizeCamelCase("hello_world"));
|
||||
}
|
||||
@Test
|
||||
public void testToCapitalizeCamelCase() {
|
||||
assertNull(KitStringUtil.toCapitalizeCamelCase(null));
|
||||
assertEquals("HelloWorld", toCapitalizeCamelCase("hello_world"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToUnderScoreCase() {
|
||||
assertNull(KitStringUtil.toUnderScoreCase(null));
|
||||
assertEquals("hello_world", toUnderScoreCase("helloWorld"));
|
||||
assertEquals("\u0000\u0000", toUnderScoreCase("\u0000\u0000"));
|
||||
assertEquals("\u0000_a", toUnderScoreCase("\u0000A"));
|
||||
}
|
||||
@Test
|
||||
public void testToUnderScoreCase() {
|
||||
assertNull(KitStringUtil.toUnderScoreCase(null));
|
||||
assertEquals("hello_world", toUnderScoreCase("helloWorld"));
|
||||
assertEquals("\u0000\u0000", toUnderScoreCase("\u0000\u0000"));
|
||||
assertEquals("\u0000_a", toUnderScoreCase("\u0000A"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetWeekDay() {
|
||||
SimpleDateFormat simpleDateformat = new SimpleDateFormat("E");
|
||||
assertEquals(simpleDateformat.format(new Date()), getWeekDay());
|
||||
}
|
||||
@Test
|
||||
public void testGetWeekDay() {
|
||||
SimpleDateFormat simpleDateformat = new SimpleDateFormat("E");
|
||||
assertEquals(simpleDateformat.format(new Date()), getWeekDay());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetIP() {
|
||||
Assertions.assertEquals("127.0.0.1", KitBrowserUtil.getIp(new MockHttpServletRequest()));
|
||||
}
|
||||
@Test
|
||||
public void testGetIP() {
|
||||
Assertions.assertEquals("127.0.0.1", KitBrowserUtil.getIp(new MockHttpServletRequest()));
|
||||
}
|
||||
}
|
||||
|
||||
+8
-7
@@ -20,11 +20,12 @@ package cn.odboy.util;
|
||||
* 钉钉 Teambition 实际工时数计算
|
||||
*/
|
||||
public class WorkTimeTests {
|
||||
public static void main(String[] args) {
|
||||
// 总工作时长(时)
|
||||
double totalHour = 11;
|
||||
// 实际工作时长(天),一天8小时工作制
|
||||
double actualHour = totalHour / 8.0;
|
||||
System.err.println("actualHour=" + actualHour + " 天");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 总工作时长(时)
|
||||
double totalHour = 11;
|
||||
// 实际工作时长(天),一天8小时工作制
|
||||
double actualHour = totalHour / 8.0;
|
||||
System.err.println("actualHour=" + actualHour + " 天");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user