Skip to content

Commit

Permalink
🎨 规范代码格式化风格
Browse files Browse the repository at this point in the history
  • Loading branch information
xkcoding committed Oct 26, 2020
1 parent 286ce0f commit 45bcd49
Show file tree
Hide file tree
Showing 137 changed files with 1,329 additions and 1,500 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ protected UserDetailsService myUserDetailsService() {
for (String[] user : usersGroupsAndRoles) {
List<String> authoritiesStrings = Arrays.asList(Arrays.copyOfRange(user, 2, user.length));
log.info("> Registering new user: " + user[0] + " with the following Authorities[" + authoritiesStrings + "]");
inMemoryUserDetailsManager.createUser(new User(user[0], passwordEncoder().encode(user[1]), authoritiesStrings
.stream()
.map(SimpleGrantedAuthority::new)
.collect(Collectors.toList())));
inMemoryUserDetailsManager.createUser(new User(user[0], passwordEncoder().encode(user[1]), authoritiesStrings.stream().map(SimpleGrantedAuthority::new).collect(Collectors.toList())));
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@SpringBootApplication
public class SpringBootDemoActuatorApplication {

public static void main(String[] args) {
SpringApplication.run(SpringBootDemoActuatorApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(SpringBootDemoActuatorApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
@SpringBootTest
public class SpringBootDemoActuatorApplicationTests {

@Test
public void contextLoads() {
}
@Test
public void contextLoads() {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@SpringBootApplication
public class SpringBootDemoAdminClientApplication {

public static void main(String[] args) {
SpringApplication.run(SpringBootDemoAdminClientApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(SpringBootDemoAdminClientApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*/
@RestController
public class IndexController {
@GetMapping(value = {"", "/"})
public String index() {
return "This is a Spring Boot Admin Client.";
}
@GetMapping(value = {"", "/"})
public String index() {
return "This is a Spring Boot Admin Client.";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
@SpringBootTest
public class SpringBootDemoAdminClientApplicationTests {

@Test
public void contextLoads() {
}
@Test
public void contextLoads() {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
@SpringBootApplication
public class SpringBootDemoAdminServerApplication {

public static void main(String[] args) {
SpringApplication.run(SpringBootDemoAdminServerApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(SpringBootDemoAdminServerApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
@SpringBootTest
public class SpringBootDemoAdminServerApplicationTests {

@Test
public void contextLoads() {
}
@Test
public void contextLoads() {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,7 @@ public void generatorCode(GenConfig genConfig, Entity table, List<Entity> column

try {
//添加到zip
zip.putNextEntry(new ZipEntry(Objects.requireNonNull(getFileName(template, tableEntity.getCaseClassName(), map
.get("package")
.toString(), map.get("moduleName").toString()))));
zip.putNextEntry(new ZipEntry(Objects.requireNonNull(getFileName(template, tableEntity.getCaseClassName(), map.get("package").toString(), map.get("moduleName").toString()))));
IoUtil.write(zip, StandardCharsets.UTF_8, false, sw.toString());
IoUtil.close(sw);
zip.closeEntry();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public synchronized void clearExpiredDatasource() {

/**
* 清除动态数据源
*
* @param id 数据源id
*/
public synchronized void removeDatasource(Long id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private void shutdown() {
}
}

public void schedule(Runnable task,long delay){
public void schedule(Runnable task, long delay) {
this.scheduler.scheduleAtFixedRate(task, delay, delay, TimeUnit.MILLISECONDS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public Connection getConnection() throws SQLException {

/**
* 初始化数据源
*
* @param id 数据源id
* @return 数据源
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ private Result(int errcode, String errmsg, T data) {
}



/**
* 返回成功
*
Expand All @@ -70,15 +69,12 @@ public static <T> Result<T> success() {
* 返回成功-携带数据
*
* @param data 响应数据
* @param <T> 泛型标记
* @param <T> 泛型标记
* @return 响应信息 {@code Result}
*/
public static <T> Result<T> success(@Nullable T data) {
return new Result<>(ResultCode.SUCCESS, data);
}





}
Original file line number Diff line number Diff line change
Expand Up @@ -17,51 +17,51 @@ public interface PersonService {
/**
* create Index
*
* @author fxbin
* @param index elasticsearch index name
* @author fxbin
*/
void createIndex(String index);

/**
* delete Index
*
* @author fxbin
* @param index elasticsearch index name
* @author fxbin
*/
void deleteIndex(String index);

/**
* insert document source
*
* @author fxbin
* @param index elasticsearch index name
* @param list data source
* @param list data source
* @author fxbin
*/
void insert(String index, List<Person> list);

/**
* update document source
*
* @author fxbin
* @param index elasticsearch index name
* @param list data source
* @param list data source
* @author fxbin
*/
void update(String index, List<Person> list);

/**
* delete document source
*
* @author fxbin
* @param person delete data source and allow null object
* @author fxbin
*/
void delete(String index, @Nullable Person person);

/**
* search all doc records
*
* @author fxbin
* @param index elasticsearch index name
* @return person list
* @author fxbin
*/
List<Person> searchList(String index);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import cn.hutool.core.bean.BeanUtil;
import com.xkcoding.elasticsearch.model.Person;
import com.xkcoding.elasticsearch.service.base.BaseElasticsearchService;
import com.xkcoding.elasticsearch.service.PersonService;
import com.xkcoding.elasticsearch.service.base.BaseElasticsearchService;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.search.SearchHit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
@SpringBootTest
public class SpringBootDemoElasticsearchApplicationTests {

@Test
public void contextLoads() {
}
@Test
public void contextLoads() {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ public void delete() {
*/
@Test
public void select() {
repo.findAll(Sort.by(Sort.Direction.DESC, "birthday"))
.forEach(person -> log.info("{} 生日: {}", person.getName(), DateUtil.formatDateTime(person.getBirthday())));
repo.findAll(Sort.by(Sort.Direction.DESC, "birthday")).forEach(person -> log.info("{} 生日: {}", person.getName(), DateUtil.formatDateTime(person.getBirthday())));
}

/**
Expand Down Expand Up @@ -167,8 +166,8 @@ public void advanceAgg() {

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
@SpringBootTest
public class SpringBootDemoEmailApplicationTests {

@Test
public void contextLoads() {
}
@Test
public void contextLoads() {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@SpringBootApplication
public class SpringBootDemoExceptionHandlerApplication {

public static void main(String[] args) {
SpringApplication.run(SpringBootDemoExceptionHandlerApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(SpringBootDemoExceptionHandlerApplication.class, args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
*/
@Getter
public enum Status {
/**
* 操作成功
*/
OK(200, "操作成功"),
/**
* 操作成功
*/
OK(200, "操作成功"),

/**
* 未知异常
*/
UNKNOWN_ERROR(500, "服务器出错啦");
/**
* 状态码
*/
private Integer code;
/**
* 内容
*/
private String message;
/**
* 未知异常
*/
UNKNOWN_ERROR(500, "服务器出错啦");
/**
* 状态码
*/
private Integer code;
/**
* 内容
*/
private String message;

Status(Integer code, String message) {
this.code = code;
this.message = message;
}
Status(Integer code, String message) {
this.code = code;
this.message = message;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
@Controller
public class TestController {

@GetMapping("/json")
@ResponseBody
public ApiResponse jsonException() {
throw new JsonException(Status.UNKNOWN_ERROR);
}
@GetMapping("/json")
@ResponseBody
public ApiResponse jsonException() {
throw new JsonException(Status.UNKNOWN_ERROR);
}

@GetMapping("/page")
public ModelAndView pageException() {
throw new PageException(Status.UNKNOWN_ERROR);
}
@GetMapping("/page")
public ModelAndView pageException() {
throw new PageException(Status.UNKNOWN_ERROR);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
@Data
@EqualsAndHashCode(callSuper = true)
public class BaseException extends RuntimeException {
private Integer code;
private String message;
private Integer code;
private String message;

public BaseException(Status status) {
super(status.getMessage());
this.code = status.getCode();
this.message = status.getMessage();
}
public BaseException(Status status) {
super(status.getMessage());
this.code = status.getCode();
this.message = status.getMessage();
}

public BaseException(Integer code, String message) {
super(message);
this.code = code;
this.message = message;
}
public BaseException(Integer code, String message) {
super(message);
this.code = code;
this.message = message;
}
}
Loading

0 comments on commit 45bcd49

Please sign in to comment.