Skip to content

Commit 34fabdf

Browse files
committed
update
1 parent 32a87f6 commit 34fabdf

File tree

242 files changed

+87135
-1493
lines changed

Some content is hidden

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

242 files changed

+87135
-1493
lines changed

.DS_Store

0 Bytes
Binary file not shown.

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ hs_err_pid*
2525
/starter/logs
2626
h2db/
2727
application-prod.properties
28+
application-dev-mysql.properties
29+
application-dev-pg.properties
2830
projects/*
2931
liangshibao/*
3032
tiku/*

modules/.DS_Store

0 Bytes
Binary file not shown.

modules/ai/.DS_Store

0 Bytes
Binary file not shown.

modules/ai/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<version>0.0.1-SNAPSHOT</version>
1111
</parent>
1212

13-
<artifactId>module-ai</artifactId>
13+
<artifactId>bytedesk-module-ai</artifactId>
1414

1515
<name>ai</name>
1616
<description>Demo project for Spring Boot</description>
@@ -58,7 +58,7 @@
5858

5959
<dependency>
6060
<groupId>com.bytedesk</groupId>
61-
<artifactId>module-core</artifactId>
61+
<artifactId>bytedesk-module-core</artifactId>
6262
<version>${im.version}</version>
6363
<scope>provided</scope>
6464
</dependency>

modules/ai/src/.DS_Store

0 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1+
/*
2+
* @Author: jackning 270580156@qq.com
3+
* @Date: 2024-02-02 09:29:02
4+
* @LastEditors: jackning 270580156@qq.com
5+
* @LastEditTime: 2024-05-20 10:08:27
6+
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
7+
* Please be aware of the BSL license restrictions before installing Bytedesk IM –
8+
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
9+
* 仅支持企业内部员工自用,严禁私自用于销售、二次销售或者部署SaaS方式销售
10+
* Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE
11+
* contact: 270580156@qq.com
12+
* 联系:270580156@qq.com
13+
* Copyright (c) 2024 by bytedesk.com, All Rights Reserved.
14+
*/
115
package com.bytedesk.ai;
216

3-
import org.springframework.boot.SpringApplication;
17+
// import org.springframework.boot.SpringApplication;
418
import org.springframework.boot.autoconfigure.SpringBootApplication;
519

620
@SpringBootApplication
721
public class AiApplication {
822

9-
public static void main(String[] args) {
10-
SpringApplication.run(AiApplication.class, args);
11-
}
23+
// public static void main(String[] args) {
24+
// SpringApplication.run(AiApplication.class, args);
25+
// }
1226

1327
}

modules/core/.DS_Store

0 Bytes
Binary file not shown.

modules/core/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<version>0.0.1-SNAPSHOT</version>
1212
</parent>
1313

14-
<artifactId>module-core</artifactId>
14+
<artifactId>bytedesk-module-core</artifactId>
1515

1616
<name>core</name>
1717
<description>Demo project for Spring Boot</description>

modules/core/src/.DS_Store

0 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1+
/*
2+
* @Author: jackning 270580156@qq.com
3+
* @Date: 2024-01-29 15:06:21
4+
* @LastEditors: jackning 270580156@qq.com
5+
* @LastEditTime: 2024-05-20 09:44:23
6+
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
7+
* Please be aware of the BSL license restrictions before installing Bytedesk IM –
8+
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
9+
* 仅支持企业内部员工自用,严禁私自用于销售、二次销售或者部署SaaS方式销售
10+
* Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE
11+
* contact: 270580156@qq.com
12+
* 联系:270580156@qq.com
13+
* Copyright (c) 2024 by bytedesk.com, All Rights Reserved.
14+
*/
115
package com.bytedesk.core;
216

3-
import org.springframework.boot.SpringApplication;
17+
// import org.springframework.boot.SpringApplication;
418
import org.springframework.boot.autoconfigure.SpringBootApplication;
519

620
@SpringBootApplication
721
public class CoreApplication {
822

9-
public static void main(String[] args) {
10-
SpringApplication.run(CoreApplication.class, args);
11-
}
23+
// public static void main(String[] args) {
24+
// SpringApplication.run(CoreApplication.class, args);
25+
// }
1226

1327
}

modules/core/src/main/java/com/bytedesk/core/apilimit/ApiRateLimiterAspect.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.aspectj.lang.annotation.Pointcut;
2525
import org.aspectj.lang.reflect.MethodSignature;
2626
import org.springframework.core.annotation.AnnotationUtils;
27+
import org.springframework.http.ResponseEntity;
2728
import org.springframework.stereotype.Component;
2829

2930
import com.bytedesk.core.utils.JsonResult;
@@ -73,8 +74,8 @@ public Object pointcut(ProceedingJoinPoint point) throws Throwable {
7374
if (proceed) {
7475
return point.proceed();
7576
}
76-
//
77-
return JsonResult.error("api out of limit, please try later");
77+
// TODO: 将相关ip记录到黑名单中,后续请求直接返回错误信息
78+
return ResponseEntity.ok(JsonResult.error("api out of limit, please try later"));
7879
}
7980

8081
}

modules/core/src/main/java/com/bytedesk/core/base/BaseService.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @Author: jackning 270580156@qq.com
33
* @Date: 2024-05-10 12:13:37
44
* @LastEditors: jackning 270580156@qq.com
5-
* @LastEditTime: 2024-05-14 15:15:37
5+
* @LastEditTime: 2024-05-15 14:19:12
66
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
77
* Please be aware of the BSL license restrictions before installing Bytedesk IM –
88
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -30,13 +30,19 @@ public abstract class BaseService<T, TRequest, TResponse> {
3030

3131
abstract public Optional<T> findByUid(String uid);
3232

33-
abstract public T save(T object);
33+
abstract public TResponse create(TRequest request);
34+
35+
abstract public TResponse update(TRequest request);
36+
37+
abstract public T save(T entity);
3438

3539
abstract public void deleteByUid(TRequest request);
3640

37-
abstract public void delete(T object);
41+
abstract public void delete(T entity);
3842

3943
abstract public void handleOptimisticLockingFailureException(ObjectOptimisticLockingFailureException e,
4044
T entity);
4145

46+
abstract public TResponse convertToResponse(T entity);
47+
4248
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/*
22
* @Author: jackning 270580156@qq.com
3-
* @Date: 2024-02-22 16:19:44
3+
* @Date: 2024-05-03 18:13:55
44
* @LastEditors: jackning 270580156@qq.com
5-
* @LastEditTime: 2024-02-22 16:35:41
5+
* @LastEditTime: 2024-05-20 10:01:28
66
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
77
* Please be aware of the BSL license restrictions before installing Bytedesk IM –
88
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
@@ -14,9 +14,80 @@
1414
*/
1515
package com.bytedesk.core.category;
1616

17-
/**
18-
* 类别
19-
*/
20-
public class Category {
17+
import java.util.List;
18+
import java.util.ArrayList;
19+
20+
import com.bytedesk.core.base.BaseEntity;
21+
import com.bytedesk.core.constant.BdConstants;
22+
import com.fasterxml.jackson.annotation.JsonIgnore;
23+
24+
import jakarta.persistence.CascadeType;
25+
import jakarta.persistence.Column;
26+
import jakarta.persistence.Entity;
27+
import jakarta.persistence.FetchType;
28+
import jakarta.persistence.JoinColumn;
29+
import jakarta.persistence.ManyToOne;
30+
import jakarta.persistence.OneToMany;
31+
import jakarta.persistence.Table;
32+
import lombok.AllArgsConstructor;
33+
import lombok.Builder;
34+
import lombok.Data;
35+
import lombok.EqualsAndHashCode;
36+
import lombok.NoArgsConstructor;
37+
import lombok.experimental.Accessors;
38+
39+
@Entity
40+
@Data
41+
@Builder
42+
@Accessors(chain = true)
43+
@EqualsAndHashCode(callSuper = true)
44+
@AllArgsConstructor
45+
@NoArgsConstructor
46+
@Table(name = "core_category")
47+
public class Category extends BaseEntity {
48+
49+
private String name;
50+
51+
// private String description;
52+
53+
@Column(name = "by_type")
54+
private String type;
55+
56+
private String icon;
57+
58+
// @Column(unique = true)
59+
// private String path;
60+
61+
/**
62+
* 排序
63+
*/
64+
@Builder.Default
65+
private Integer orderNo = 0;
66+
67+
@JsonIgnore
68+
@ManyToOne(fetch = FetchType.LAZY)
69+
@JoinColumn(name = "parent_id")
70+
private Category parent;
71+
72+
// 需要排序,所以使用List
73+
@Builder.Default
74+
@OneToMany(mappedBy = "parent", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
75+
private List<Category> children = new ArrayList<>();
76+
77+
@Builder.Default
78+
private String platform = BdConstants.PLATFORM_BYTEDESK;
79+
80+
/** belong to org */
81+
private String orgUid;
82+
83+
public void addChild(Category child) {
84+
children.add(child);
85+
child.setParent(this);
86+
}
87+
88+
public void removeChild(Category child) {
89+
children.remove(child);
90+
child.setParent(null);
91+
}
2192

2293
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
* @Author: jackning 270580156@qq.com
3+
* @Date: 2024-05-11 18:21:26
4+
* @LastEditors: jackning 270580156@qq.com
5+
* @LastEditTime: 2024-05-20 12:51:23
6+
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
7+
* Please be aware of the BSL license restrictions before installing Bytedesk IM –
8+
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
9+
* 仅支持企业内部员工自用,严禁私自用于销售、二次销售或者部署SaaS方式销售
10+
* Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE
11+
* contact: 270580156@qq.com
12+
* 联系:270580156@qq.com
13+
* Copyright (c) 2024 by bytedesk.com, All Rights Reserved.
14+
*/
15+
package com.bytedesk.core.category;
16+
17+
import org.springframework.http.ResponseEntity;
18+
import org.springframework.web.bind.annotation.RequestMapping;
19+
import org.springframework.web.bind.annotation.RestController;
20+
21+
import com.bytedesk.core.base.BaseController;
22+
23+
import lombok.AllArgsConstructor;
24+
25+
@RestController
26+
@AllArgsConstructor
27+
@RequestMapping("/api/v1/category")
28+
public class CategoryController extends BaseController<CategoryRequest> {
29+
30+
// private final CategoryService categoryService;
31+
32+
@Override
33+
public ResponseEntity<?> queryByOrg(CategoryRequest request) {
34+
// TODO Auto-generated method stub
35+
throw new UnsupportedOperationException("Unimplemented method 'queryByOrg'");
36+
}
37+
38+
@Override
39+
public ResponseEntity<?> query(CategoryRequest request) {
40+
// TODO Auto-generated method stub
41+
throw new UnsupportedOperationException("Unimplemented method 'query'");
42+
}
43+
44+
@Override
45+
public ResponseEntity<?> create(CategoryRequest request) {
46+
// TODO Auto-generated method stub
47+
throw new UnsupportedOperationException("Unimplemented method 'create'");
48+
}
49+
50+
@Override
51+
public ResponseEntity<?> update(CategoryRequest request) {
52+
// TODO Auto-generated method stub
53+
throw new UnsupportedOperationException("Unimplemented method 'update'");
54+
}
55+
56+
@Override
57+
public ResponseEntity<?> delete(CategoryRequest request) {
58+
// TODO Auto-generated method stub
59+
throw new UnsupportedOperationException("Unimplemented method 'delete'");
60+
}
61+
62+
@Override
63+
public ResponseEntity<?> filter(CategoryRequest filterParam) {
64+
// TODO Auto-generated method stub
65+
throw new UnsupportedOperationException("Unimplemented method 'filter'");
66+
}
67+
68+
69+
70+
71+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* @Author: jackning 270580156@qq.com
3+
* @Date: 2024-05-11 18:21:36
4+
* @LastEditors: jackning 270580156@qq.com
5+
* @LastEditTime: 2024-05-20 14:01:05
6+
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
7+
* Please be aware of the BSL license restrictions before installing Bytedesk IM –
8+
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
9+
* 仅支持企业内部员工自用,严禁私自用于销售、二次销售或者部署SaaS方式销售
10+
* Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE
11+
* contact: 270580156@qq.com
12+
* 联系:270580156@qq.com
13+
* Copyright (c) 2024 by bytedesk.com, All Rights Reserved.
14+
*/
15+
package com.bytedesk.core.category;
16+
17+
import java.util.List;
18+
import java.util.Optional;
19+
20+
import org.springframework.data.jpa.repository.JpaRepository;
21+
22+
public interface CategoryRepository extends JpaRepository<Category, Long> {
23+
24+
Optional<Category> findByUid(String uid);
25+
26+
List<Category> findByParentAndPlatformOrderByOrderNoAsc(Category parent, String platform);
27+
28+
Boolean existsByPlatform(String platform);
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* @Author: jackning 270580156@qq.com
3+
* @Date: 2024-05-11 18:21:44
4+
* @LastEditors: jackning 270580156@qq.com
5+
* @LastEditTime: 2024-05-18 18:11:14
6+
* @Description: bytedesk.com https://github.com/Bytedesk/bytedesk
7+
* Please be aware of the BSL license restrictions before installing Bytedesk IM –
8+
* selling, reselling, or hosting Bytedesk IM as a service is a breach of the terms and automatically terminates your rights under the license.
9+
* 仅支持企业内部员工自用,严禁私自用于销售、二次销售或者部署SaaS方式销售
10+
* Business Source License 1.1: https://github.com/Bytedesk/bytedesk/blob/main/LICENSE
11+
* contact: 270580156@qq.com
12+
* 联系:270580156@qq.com
13+
* Copyright (c) 2024 by bytedesk.com, All Rights Reserved.
14+
*/
15+
package com.bytedesk.core.category;
16+
17+
import java.util.Set;
18+
19+
import com.bytedesk.core.base.BaseRequest;
20+
21+
import lombok.AllArgsConstructor;
22+
import lombok.Builder;
23+
import lombok.Data;
24+
import lombok.EqualsAndHashCode;
25+
import lombok.NoArgsConstructor;
26+
import lombok.experimental.Accessors;
27+
28+
@Data
29+
@Builder
30+
@Accessors(chain = true)
31+
@EqualsAndHashCode(callSuper = false)
32+
@AllArgsConstructor
33+
@NoArgsConstructor
34+
public class CategoryRequest extends BaseRequest {
35+
36+
private String name;
37+
38+
private String icon;
39+
40+
private Integer orderNo;
41+
42+
private String platform;
43+
44+
private Set<String> children;
45+
}

0 commit comments

Comments
 (0)