Skip to content

Commit 45bcd49

Browse files
committed
🎨 规范代码格式化风格
1 parent 286ce0f commit 45bcd49

File tree

137 files changed

+1329
-1500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+1329
-1500
lines changed

demo-activiti/src/main/java/com/xkcoding/activiti/config/SecurityConfiguration.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ protected UserDetailsService myUserDetailsService() {
4242
for (String[] user : usersGroupsAndRoles) {
4343
List<String> authoritiesStrings = Arrays.asList(Arrays.copyOfRange(user, 2, user.length));
4444
log.info("> Registering new user: " + user[0] + " with the following Authorities[" + authoritiesStrings + "]");
45-
inMemoryUserDetailsManager.createUser(new User(user[0], passwordEncoder().encode(user[1]), authoritiesStrings
46-
.stream()
47-
.map(SimpleGrantedAuthority::new)
48-
.collect(Collectors.toList())));
45+
inMemoryUserDetailsManager.createUser(new User(user[0], passwordEncoder().encode(user[1]), authoritiesStrings.stream().map(SimpleGrantedAuthority::new).collect(Collectors.toList())));
4946
}
5047

5148

demo-actuator/src/main/java/com/xkcoding/actuator/SpringBootDemoActuatorApplication.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@SpringBootApplication
1515
public class SpringBootDemoActuatorApplication {
1616

17-
public static void main(String[] args) {
18-
SpringApplication.run(SpringBootDemoActuatorApplication.class, args);
19-
}
17+
public static void main(String[] args) {
18+
SpringApplication.run(SpringBootDemoActuatorApplication.class, args);
19+
}
2020
}

demo-actuator/src/test/java/com/xkcoding/actuator/SpringBootDemoActuatorApplicationTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
@SpringBootTest
1010
public class SpringBootDemoActuatorApplicationTests {
1111

12-
@Test
13-
public void contextLoads() {
14-
}
12+
@Test
13+
public void contextLoads() {
14+
}
1515

1616
}

demo-admin/admin-client/src/main/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplication.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@SpringBootApplication
1515
public class SpringBootDemoAdminClientApplication {
1616

17-
public static void main(String[] args) {
18-
SpringApplication.run(SpringBootDemoAdminClientApplication.class, args);
19-
}
17+
public static void main(String[] args) {
18+
SpringApplication.run(SpringBootDemoAdminClientApplication.class, args);
19+
}
2020
}

demo-admin/admin-client/src/main/java/com/xkcoding/admin/client/controller/IndexController.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
*/
1414
@RestController
1515
public class IndexController {
16-
@GetMapping(value = {"", "/"})
17-
public String index() {
18-
return "This is a Spring Boot Admin Client.";
19-
}
16+
@GetMapping(value = {"", "/"})
17+
public String index() {
18+
return "This is a Spring Boot Admin Client.";
19+
}
2020
}

demo-admin/admin-client/src/test/java/com/xkcoding/admin/client/SpringBootDemoAdminClientApplicationTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
@SpringBootTest
1010
public class SpringBootDemoAdminClientApplicationTests {
1111

12-
@Test
13-
public void contextLoads() {
14-
}
12+
@Test
13+
public void contextLoads() {
14+
}
1515

1616
}

demo-admin/admin-server/src/main/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplication.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@SpringBootApplication
1717
public class SpringBootDemoAdminServerApplication {
1818

19-
public static void main(String[] args) {
20-
SpringApplication.run(SpringBootDemoAdminServerApplication.class, args);
21-
}
19+
public static void main(String[] args) {
20+
SpringApplication.run(SpringBootDemoAdminServerApplication.class, args);
21+
}
2222
}

demo-admin/admin-server/src/test/java/com/xkcoding/admin/server/SpringBootDemoAdminServerApplicationTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
@SpringBootTest
1010
public class SpringBootDemoAdminServerApplicationTests {
1111

12-
@Test
13-
public void contextLoads() {
14-
}
12+
@Test
13+
public void contextLoads() {
14+
}
1515

1616
}

demo-codegen/src/main/java/com/xkcoding/codegen/utils/CodeGenUtil.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,7 @@ public void generatorCode(GenConfig genConfig, Entity table, List<Entity> column
179179

180180
try {
181181
//添加到zip
182-
zip.putNextEntry(new ZipEntry(Objects.requireNonNull(getFileName(template, tableEntity.getCaseClassName(), map
183-
.get("package")
184-
.toString(), map.get("moduleName").toString()))));
182+
zip.putNextEntry(new ZipEntry(Objects.requireNonNull(getFileName(template, tableEntity.getCaseClassName(), map.get("package").toString(), map.get("moduleName").toString()))));
185183
IoUtil.write(zip, StandardCharsets.UTF_8, false, sw.toString());
186184
IoUtil.close(sw);
187185
zip.closeEntry();

demo-dynamic-datasource/src/main/java/com/xkcoding/dynamic/datasource/datasource/DatasourceHolder.java

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public synchronized void clearExpiredDatasource() {
7878

7979
/**
8080
* 清除动态数据源
81+
*
8182
* @param id 数据源id
8283
*/
8384
public synchronized void removeDatasource(Long id) {

demo-dynamic-datasource/src/main/java/com/xkcoding/dynamic/datasource/datasource/DatasourceScheduler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private void shutdown() {
3737
}
3838
}
3939

40-
public void schedule(Runnable task,long delay){
40+
public void schedule(Runnable task, long delay) {
4141
this.scheduler.scheduleAtFixedRate(task, delay, delay, TimeUnit.MILLISECONDS);
4242
}
4343

demo-dynamic-datasource/src/main/java/com/xkcoding/dynamic/datasource/datasource/DynamicDataSource.java

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public Connection getConnection() throws SQLException {
3535

3636
/**
3737
* 初始化数据源
38+
*
3839
* @param id 数据源id
3940
* @return 数据源
4041
*/

demo-elasticsearch-rest-high-level-client/src/main/java/com/xkcoding/elasticsearch/common/Result.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ private Result(int errcode, String errmsg, T data) {
5454
}
5555

5656

57-
5857
/**
5958
* 返回成功
6059
*
@@ -70,15 +69,12 @@ public static <T> Result<T> success() {
7069
* 返回成功-携带数据
7170
*
7271
* @param data 响应数据
73-
* @param <T> 泛型标记
72+
* @param <T> 泛型标记
7473
* @return 响应信息 {@code Result}
7574
*/
7675
public static <T> Result<T> success(@Nullable T data) {
7776
return new Result<>(ResultCode.SUCCESS, data);
7877
}
7978

8079

81-
82-
83-
8480
}

demo-elasticsearch-rest-high-level-client/src/main/java/com/xkcoding/elasticsearch/service/PersonService.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,51 +17,51 @@ public interface PersonService {
1717
/**
1818
* create Index
1919
*
20-
* @author fxbin
2120
* @param index elasticsearch index name
21+
* @author fxbin
2222
*/
2323
void createIndex(String index);
2424

2525
/**
2626
* delete Index
2727
*
28-
* @author fxbin
2928
* @param index elasticsearch index name
29+
* @author fxbin
3030
*/
3131
void deleteIndex(String index);
3232

3333
/**
3434
* insert document source
3535
*
36-
* @author fxbin
3736
* @param index elasticsearch index name
38-
* @param list data source
37+
* @param list data source
38+
* @author fxbin
3939
*/
4040
void insert(String index, List<Person> list);
4141

4242
/**
4343
* update document source
4444
*
45-
* @author fxbin
4645
* @param index elasticsearch index name
47-
* @param list data source
46+
* @param list data source
47+
* @author fxbin
4848
*/
4949
void update(String index, List<Person> list);
5050

5151
/**
5252
* delete document source
5353
*
54-
* @author fxbin
5554
* @param person delete data source and allow null object
55+
* @author fxbin
5656
*/
5757
void delete(String index, @Nullable Person person);
5858

5959
/**
6060
* search all doc records
6161
*
62-
* @author fxbin
6362
* @param index elasticsearch index name
6463
* @return person list
64+
* @author fxbin
6565
*/
6666
List<Person> searchList(String index);
6767

demo-elasticsearch-rest-high-level-client/src/main/java/com/xkcoding/elasticsearch/service/impl/PersonServiceImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import cn.hutool.core.bean.BeanUtil;
44
import com.xkcoding.elasticsearch.model.Person;
5-
import com.xkcoding.elasticsearch.service.base.BaseElasticsearchService;
65
import com.xkcoding.elasticsearch.service.PersonService;
6+
import com.xkcoding.elasticsearch.service.base.BaseElasticsearchService;
77
import org.elasticsearch.action.index.IndexRequest;
88
import org.elasticsearch.action.search.SearchResponse;
99
import org.elasticsearch.search.SearchHit;

demo-elasticsearch/src/test/java/com/xkcoding/elasticsearch/SpringBootDemoElasticsearchApplicationTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
@SpringBootTest
1010
public class SpringBootDemoElasticsearchApplicationTests {
1111

12-
@Test
13-
public void contextLoads() {
14-
}
12+
@Test
13+
public void contextLoads() {
14+
}
1515

1616
}

demo-elasticsearch/src/test/java/com/xkcoding/elasticsearch/repository/PersonRepositoryTest.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ public void delete() {
9292
*/
9393
@Test
9494
public void select() {
95-
repo.findAll(Sort.by(Sort.Direction.DESC, "birthday"))
96-
.forEach(person -> log.info("{} 生日: {}", person.getName(), DateUtil.formatDateTime(person.getBirthday())));
95+
repo.findAll(Sort.by(Sort.Direction.DESC, "birthday")).forEach(person -> log.info("{} 生日: {}", person.getName(), DateUtil.formatDateTime(person.getBirthday())));
9796
}
9897

9998
/**
@@ -167,8 +166,8 @@ public void advanceAgg() {
167166

168167
// 1. 添加一个新的聚合,聚合类型为terms,聚合名称为country,聚合字段为age
169168
queryBuilder.addAggregation(AggregationBuilders.terms("country").field("country")
170-
// 2. 在国家聚合桶内进行嵌套聚合,求平均年龄
171-
.subAggregation(AggregationBuilders.avg("avg").field("age")));
169+
// 2. 在国家聚合桶内进行嵌套聚合,求平均年龄
170+
.subAggregation(AggregationBuilders.avg("avg").field("age")));
172171

173172
log.info("【queryBuilder】= {}", JSONUtil.toJsonStr(queryBuilder.build()));
174173

demo-email/src/test/java/com/xkcoding/email/SpringBootDemoEmailApplicationTests.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
@SpringBootTest
1010
public class SpringBootDemoEmailApplicationTests {
1111

12-
@Test
13-
public void contextLoads() {
14-
}
12+
@Test
13+
public void contextLoads() {
14+
}
1515

1616
}

demo-exception-handler/src/main/java/com/xkcoding/exception/handler/SpringBootDemoExceptionHandlerApplication.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@SpringBootApplication
1515
public class SpringBootDemoExceptionHandlerApplication {
1616

17-
public static void main(String[] args) {
18-
SpringApplication.run(SpringBootDemoExceptionHandlerApplication.class, args);
19-
}
17+
public static void main(String[] args) {
18+
SpringApplication.run(SpringBootDemoExceptionHandlerApplication.class, args);
19+
}
2020
}

demo-exception-handler/src/main/java/com/xkcoding/exception/handler/constant/Status.java

+20-20
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@
1212
*/
1313
@Getter
1414
public enum Status {
15-
/**
16-
* 操作成功
17-
*/
18-
OK(200, "操作成功"),
15+
/**
16+
* 操作成功
17+
*/
18+
OK(200, "操作成功"),
1919

20-
/**
21-
* 未知异常
22-
*/
23-
UNKNOWN_ERROR(500, "服务器出错啦");
24-
/**
25-
* 状态码
26-
*/
27-
private Integer code;
28-
/**
29-
* 内容
30-
*/
31-
private String message;
20+
/**
21+
* 未知异常
22+
*/
23+
UNKNOWN_ERROR(500, "服务器出错啦");
24+
/**
25+
* 状态码
26+
*/
27+
private Integer code;
28+
/**
29+
* 内容
30+
*/
31+
private String message;
3232

33-
Status(Integer code, String message) {
34-
this.code = code;
35-
this.message = message;
36-
}
33+
Status(Integer code, String message) {
34+
this.code = code;
35+
this.message = message;
36+
}
3737
}

demo-exception-handler/src/main/java/com/xkcoding/exception/handler/controller/TestController.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
@Controller
2121
public class TestController {
2222

23-
@GetMapping("/json")
24-
@ResponseBody
25-
public ApiResponse jsonException() {
26-
throw new JsonException(Status.UNKNOWN_ERROR);
27-
}
23+
@GetMapping("/json")
24+
@ResponseBody
25+
public ApiResponse jsonException() {
26+
throw new JsonException(Status.UNKNOWN_ERROR);
27+
}
2828

29-
@GetMapping("/page")
30-
public ModelAndView pageException() {
31-
throw new PageException(Status.UNKNOWN_ERROR);
32-
}
29+
@GetMapping("/page")
30+
public ModelAndView pageException() {
31+
throw new PageException(Status.UNKNOWN_ERROR);
32+
}
3333
}

demo-exception-handler/src/main/java/com/xkcoding/exception/handler/exception/BaseException.java

+12-12
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
@Data
1616
@EqualsAndHashCode(callSuper = true)
1717
public class BaseException extends RuntimeException {
18-
private Integer code;
19-
private String message;
18+
private Integer code;
19+
private String message;
2020

21-
public BaseException(Status status) {
22-
super(status.getMessage());
23-
this.code = status.getCode();
24-
this.message = status.getMessage();
25-
}
21+
public BaseException(Status status) {
22+
super(status.getMessage());
23+
this.code = status.getCode();
24+
this.message = status.getMessage();
25+
}
2626

27-
public BaseException(Integer code, String message) {
28-
super(message);
29-
this.code = code;
30-
this.message = message;
31-
}
27+
public BaseException(Integer code, String message) {
28+
super(message);
29+
this.code = code;
30+
this.message = message;
31+
}
3232
}

0 commit comments

Comments
 (0)