cloudcc-cli 1.9.6 → 1.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/java/com/cloudcc/core/CCObject.java +73 -0
- package/{core → java/com/cloudcc}/core/CCService.java +139 -334
- package/java/com/cloudcc/core/CCTrigger.java +38 -0
- package/{core/core/CCTrigger.java → java/com/cloudcc/core/CCTriggerDemo.java} +4 -2
- package/java/com/cloudcc/core/CCTriggerHandler.java +17 -0
- package/java/com/cloudcc/core/SendEmail.java +23 -0
- package/java/com/cloudcc/core/ServiceResult.java +36 -0
- package/java/com/cloudcc/core/TimeUtil.java +11 -0
- package/java/com/cloudcc/core/Tool.java +270 -0
- package/{core → java/com/cloudcc}/core/TriggerInvoker.java +21 -17
- package/java/com/cloudcc/core/UserInfo.java +57 -0
- package/lib/fastjson-1.2.83.jar +0 -0
- package/lib/jackson-databind-2.13.3.jar +0 -0
- package/lib/log4j-1.2.17.jar +0 -0
- package/lib/reflections-0.9.12.jar +0 -0
- package/lib/slf4j-api-1.7.32.jar +0 -0
- package/lib/slf4j-log4j12-1.7.32.jar +0 -0
- package/package.json +3 -2
- package/pom.xml +100 -0
- package/src/classes/create.js +19 -2
- package/template/index.js +38 -1
- package/template/lib/ccopenapi-0.0.1.jar +0 -0
- package/template/lib/fastjson-1.2.83.jar +0 -0
- package/template/lib/reflections-0.9.12.jar +0 -0
- package/core/core/CCObject.java +0 -48
- package/core/core/CCTriggerHandler.java +0 -15
- package/core/core/PeakSvc.java +0 -8
- package/core/core/ServiceResult.java +0 -35
- package/core/core/UserInfo.java +0 -45
- /package/{core → java/com/cloudcc}/core/DevLogger.java +0 -0
- /package/{core → java/com/cloudcc}/core/OperatationEnum.java +0 -0
- /package/{core → java/com/cloudcc}/core/PeakInterf.java +0 -0
- /package/{core → java/com/cloudcc}/core/TriggerMethod.java +0 -0
- /package/{core → java/com/cloudcc}/core/TriggerTimeEnum.java +0 -0
package/pom.xml
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
2
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
3
|
+
<modelVersion>4.0.0</modelVersion>
|
|
4
|
+
|
|
5
|
+
<groupId>com.cloudcc.core</groupId>
|
|
6
|
+
<artifactId>ccopenapi</artifactId>
|
|
7
|
+
<version>0.0.1</version>
|
|
8
|
+
<packaging>jar</packaging>
|
|
9
|
+
<name>ccopenapi</name>
|
|
10
|
+
<dependencies>
|
|
11
|
+
<!-- 添加 fastjson 依赖 -->
|
|
12
|
+
<dependency>
|
|
13
|
+
<groupId>com.alibaba</groupId>
|
|
14
|
+
<artifactId>fastjson</artifactId>
|
|
15
|
+
<version>1.2.75</version>
|
|
16
|
+
</dependency>
|
|
17
|
+
<!-- 添加 log4j 依赖 -->
|
|
18
|
+
<dependency>
|
|
19
|
+
<groupId>log4j</groupId>
|
|
20
|
+
<artifactId>log4j</artifactId>
|
|
21
|
+
<version>1.2.17</version>
|
|
22
|
+
</dependency>
|
|
23
|
+
<!-- 添加 org.reflections 依赖 -->
|
|
24
|
+
<dependency>
|
|
25
|
+
<groupId>org.reflections</groupId>
|
|
26
|
+
<artifactId>reflections</artifactId>
|
|
27
|
+
<version>0.9.12</version>
|
|
28
|
+
</dependency>
|
|
29
|
+
<!-- 添加 Jackson 依赖 -->
|
|
30
|
+
<dependency>
|
|
31
|
+
<groupId>com.fasterxml.jackson.core</groupId>
|
|
32
|
+
<artifactId>jackson-databind</artifactId>
|
|
33
|
+
<version>2.13.3</version>
|
|
34
|
+
</dependency>
|
|
35
|
+
<!-- 添加 slf4j 依赖 -->
|
|
36
|
+
<dependency>
|
|
37
|
+
<groupId>org.slf4j</groupId>
|
|
38
|
+
<artifactId>slf4j-api</artifactId>
|
|
39
|
+
<version>1.7.32</version>
|
|
40
|
+
</dependency>
|
|
41
|
+
<dependency>
|
|
42
|
+
<groupId>org.slf4j</groupId>
|
|
43
|
+
<artifactId>slf4j-log4j12</artifactId>
|
|
44
|
+
<version>1.7.32</version>
|
|
45
|
+
</dependency>
|
|
46
|
+
</dependencies>
|
|
47
|
+
|
|
48
|
+
<build>
|
|
49
|
+
<plugins>
|
|
50
|
+
<plugin>
|
|
51
|
+
<groupId>org.codehaus.mojo</groupId>
|
|
52
|
+
<artifactId>build-helper-maven-plugin</artifactId>
|
|
53
|
+
<version>3.2.0</version>
|
|
54
|
+
<executions>
|
|
55
|
+
<execution>
|
|
56
|
+
<id>add-extra-source</id>
|
|
57
|
+
<phase>generate-sources</phase>
|
|
58
|
+
<goals>
|
|
59
|
+
<goal>add-source</goal>
|
|
60
|
+
</goals>
|
|
61
|
+
<configuration>
|
|
62
|
+
<sources>
|
|
63
|
+
<source>${project.basedir}/java</source>
|
|
64
|
+
</sources>
|
|
65
|
+
</configuration>
|
|
66
|
+
</execution>
|
|
67
|
+
</executions>
|
|
68
|
+
</plugin>
|
|
69
|
+
|
|
70
|
+
<plugin>
|
|
71
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
72
|
+
<artifactId>maven-compiler-plugin</artifactId>
|
|
73
|
+
<version>3.8.1</version>
|
|
74
|
+
<configuration>
|
|
75
|
+
<source>8</source>
|
|
76
|
+
<target>8</target>
|
|
77
|
+
</configuration>
|
|
78
|
+
</plugin>
|
|
79
|
+
|
|
80
|
+
<plugin>
|
|
81
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
82
|
+
<artifactId>maven-jar-plugin</artifactId>
|
|
83
|
+
<version>3.2.0</version>
|
|
84
|
+
<executions>
|
|
85
|
+
<execution>
|
|
86
|
+
<goals>
|
|
87
|
+
<goal>jar</goal>
|
|
88
|
+
</goals>
|
|
89
|
+
<configuration>
|
|
90
|
+
<includes>
|
|
91
|
+
<include>com/cloudcc/**/*.class</include>
|
|
92
|
+
</includes>
|
|
93
|
+
<classifier>classes</classifier> <!-- 添加 classifier 元素 -->
|
|
94
|
+
</configuration>
|
|
95
|
+
</execution>
|
|
96
|
+
</executions>
|
|
97
|
+
</plugin>
|
|
98
|
+
</plugins>
|
|
99
|
+
</build>
|
|
100
|
+
</project>
|
package/src/classes/create.js
CHANGED
|
@@ -11,7 +11,10 @@ async function create(name) {
|
|
|
11
11
|
try {
|
|
12
12
|
fs.mkdirSync(classesPath, { recursive: true })
|
|
13
13
|
const javaTmp =
|
|
14
|
-
|
|
14
|
+
`package classes.${name};
|
|
15
|
+
|
|
16
|
+
import com.cloudcc.core.*;
|
|
17
|
+
// @SOURCE_CONTENT_START
|
|
15
18
|
public class ${name}{
|
|
16
19
|
private UserInfo userInfo;
|
|
17
20
|
private CCService cs;
|
|
@@ -24,14 +27,28 @@ public class ${name}{
|
|
|
24
27
|
this.cs=cs;
|
|
25
28
|
}
|
|
26
29
|
|
|
27
|
-
public String
|
|
30
|
+
public String getName(String str){
|
|
28
31
|
str = "demo";
|
|
29
32
|
return str;
|
|
30
33
|
}
|
|
31
34
|
}
|
|
32
35
|
// @SOURCE_CONTENT_END
|
|
36
|
+
`
|
|
37
|
+
const javaTestTmp =
|
|
38
|
+
`package classes.${name};
|
|
39
|
+
|
|
40
|
+
import com.cloudcc.core.*;
|
|
41
|
+
|
|
42
|
+
public class ${name}Test {
|
|
43
|
+
public static void main(String[] args) {
|
|
44
|
+
${name} obj = new ${name}(new UserInfo());
|
|
45
|
+
String name = obj.getName("test");
|
|
46
|
+
System.out.println("name:" + name);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
33
49
|
`
|
|
34
50
|
fs.writeFileSync(path.join(classesPath, name + ".java"), javaTmp)
|
|
51
|
+
fs.writeFileSync(path.join(classesPath, name + "Test.java"), javaTestTmp)
|
|
35
52
|
fs.writeFileSync(path.join(classesPath, "config.json"), `{"name":"${name}","version":"${getPackageJson().extandVersion || '2'}"}`)
|
|
36
53
|
console.log()
|
|
37
54
|
console.log(chalk.green("Successfully Created:" + name))
|
package/template/index.js
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const chalk = require("chalk")
|
|
3
3
|
const path = require("path")
|
|
4
|
+
|
|
5
|
+
// 添加递归复制文件夹的函数
|
|
6
|
+
function copyFolderSync(source, target) {
|
|
7
|
+
// 确保目标文件夹存在
|
|
8
|
+
if (!fs.existsSync(target)) {
|
|
9
|
+
fs.mkdirSync(target, { recursive: true });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// 读取源文件夹内容
|
|
13
|
+
const files = fs.readdirSync(source);
|
|
14
|
+
|
|
15
|
+
// 遍历并复制每个文件/文件夹
|
|
16
|
+
files.forEach(file => {
|
|
17
|
+
const sourcePath = path.join(source, file);
|
|
18
|
+
const targetPath = path.join(target, file);
|
|
19
|
+
|
|
20
|
+
// 判断是文件还是文件夹
|
|
21
|
+
if (fs.statSync(sourcePath).isDirectory()) {
|
|
22
|
+
// 如果是文件夹,递归复制
|
|
23
|
+
copyFolderSync(sourcePath, targetPath);
|
|
24
|
+
} else {
|
|
25
|
+
// 如果是文件,直接复制
|
|
26
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
4
31
|
module.exports = function (creator, options, callback) {
|
|
5
32
|
const { name, description } = options;
|
|
6
33
|
|
|
@@ -15,6 +42,15 @@ module.exports = function (creator, options, callback) {
|
|
|
15
42
|
const public = path.join(projectPath, "public");
|
|
16
43
|
fs.mkdirSync(public)
|
|
17
44
|
|
|
45
|
+
const libPath = path.join(projectPath, "lib");
|
|
46
|
+
fs.mkdirSync(libPath)
|
|
47
|
+
|
|
48
|
+
const templateLibPath = path.join(__dirname, "lib");
|
|
49
|
+
if (fs.existsSync(templateLibPath)) {
|
|
50
|
+
copyFolderSync(templateLibPath, libPath);
|
|
51
|
+
console.log(`${chalk.grey(`Copy lib folder to ${name}/lib`)} ${chalk.green('✔ ')}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
18
54
|
creator.copyTpl('cloudcc-cli.configjs', path.join(projectPath, "cloudcc-cli.config.js"))
|
|
19
55
|
|
|
20
56
|
creator.copyTpl('gitignore', path.join(projectPath, ".gitignore"))
|
|
@@ -45,7 +81,8 @@ module.exports = function (creator, options, callback) {
|
|
|
45
81
|
console.log(`${chalk.grey(`Create directory: ${name}/public`)} ${chalk.green('✔ ')}`);
|
|
46
82
|
console.log(`${chalk.grey(`Create file: ${name}/public/index.html`)} ${chalk.green('✔ ')}`);
|
|
47
83
|
|
|
48
|
-
console.log(`${chalk.grey(`Create
|
|
84
|
+
console.log(`${chalk.grey(`Create directory: ${name}/lib`)} ${chalk.green('✔ ')}`);
|
|
85
|
+
console.log(`${chalk.grey(`Create directory: ${name}/src`)} ${chalk.green('✔ ')}`);
|
|
49
86
|
console.log(`${chalk.grey(`Create file: ${name}/src/App.vue`)} ${chalk.green('✔ ')}`);
|
|
50
87
|
console.log(`${chalk.grey(`Create file: ${name}/src/main.js`)} ${chalk.green('✔ ')}`);
|
|
51
88
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/core/core/CCObject.java
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
package com.cloudcc.core;
|
|
2
|
-
|
|
3
|
-
import java.util.HashMap;
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @author T.han
|
|
7
|
-
* @date 2023/8/17 16:18
|
|
8
|
-
* @project CloudccNewPro
|
|
9
|
-
* @Description //TODO
|
|
10
|
-
*/
|
|
11
|
-
public class CCObject extends HashMap<String,Object> {
|
|
12
|
-
public static final String OBJECT_API = "CCObjectAPI";
|
|
13
|
-
public static final String IS_SHARED = "isShared";
|
|
14
|
-
|
|
15
|
-
public CCObject() {
|
|
16
|
-
/* compiled code */
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public CCObject(String ccobj) {
|
|
21
|
-
/* compiled code */
|
|
22
|
-
put("CCObjectAPI", ccobj);
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
public CCObject(String ccobj, String isShared) {
|
|
27
|
-
/* compiled code */
|
|
28
|
-
put("CCObjectAPI", ccobj);
|
|
29
|
-
put("isShared", "isShared");
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public void putSumValue(String sumValueKey, String value) {
|
|
33
|
-
/* compiled code */
|
|
34
|
-
put("sum" + sumValueKey, value);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public Object getSumValue(String sumValueKey) {
|
|
38
|
-
/* compiled code */
|
|
39
|
-
return get("sum" + sumValueKey);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
public String getObjectApiName() {
|
|
43
|
-
/* compiled code */
|
|
44
|
-
return (String)get("CCObjectAPI");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
package com.cloudcc.core;
|
|
2
|
-
|
|
3
|
-
import java.util.Map;
|
|
4
|
-
|
|
5
|
-
public abstract class CCTriggerHandler extends CCService {
|
|
6
|
-
public Map record_new;
|
|
7
|
-
public Map record_old;
|
|
8
|
-
public ServiceResult trigger;
|
|
9
|
-
public CCTriggerHandler(Map triggernew, Map triggerold, ServiceResult svc, UserInfo uinfo){
|
|
10
|
-
super(uinfo);
|
|
11
|
-
this.record_new = triggernew;
|
|
12
|
-
this.record_old = triggerold;
|
|
13
|
-
this.trigger = svc;
|
|
14
|
-
}
|
|
15
|
-
}
|
package/core/core/PeakSvc.java
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
package com.cloudcc.core;
|
|
2
|
-
|
|
3
|
-
import com.alibaba.fastjson.JSONObject;
|
|
4
|
-
|
|
5
|
-
import java.util.HashMap;
|
|
6
|
-
|
|
7
|
-
public class ServiceResult extends HashMap {
|
|
8
|
-
public String success;
|
|
9
|
-
public String message;
|
|
10
|
-
public String Id;
|
|
11
|
-
|
|
12
|
-
public void addErrorMessage(String msg) throws Exception{
|
|
13
|
-
this.put("message",msg);
|
|
14
|
-
this.put("success","false");
|
|
15
|
-
throw new Exception(msg);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public String getMessage(){
|
|
19
|
-
return (String)this.get("message");
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public String getSuccess(){
|
|
23
|
-
return (String)this.get("success");
|
|
24
|
-
}
|
|
25
|
-
public String getId(){
|
|
26
|
-
return (String)this.get("id");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@Override
|
|
30
|
-
public String toString(){
|
|
31
|
-
JSONObject data = new JSONObject();
|
|
32
|
-
data.putAll(this);
|
|
33
|
-
return data.toString();
|
|
34
|
-
}
|
|
35
|
-
}
|
package/core/core/UserInfo.java
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
package com.cloudcc.core;
|
|
2
|
-
|
|
3
|
-
import com.cloudcc.core.CCObject;
|
|
4
|
-
|
|
5
|
-
public class UserInfo extends CCObject{
|
|
6
|
-
public String binding;
|
|
7
|
-
public String getUserId() {
|
|
8
|
-
return (String)this.get("id");
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
public String getRoleId() {
|
|
12
|
-
return (String)this.get("role");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public UserInfo (String username,String pwd) throws Exception {
|
|
16
|
-
this.put("userName", username);
|
|
17
|
-
this.put("password", pwd);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public UserInfo() {
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public String getLoginName(){
|
|
25
|
-
return (String)this.get("userName");
|
|
26
|
-
}
|
|
27
|
-
public String getProfileId() {
|
|
28
|
-
// TODO Auto-generated method stub
|
|
29
|
-
return (String)this.get("profileId");
|
|
30
|
-
}
|
|
31
|
-
public void setBinding(String bind){
|
|
32
|
-
this.binding = bind;
|
|
33
|
-
this.put("binding",bind);
|
|
34
|
-
}
|
|
35
|
-
public String getBinding(){
|
|
36
|
-
if (this.binding == null){
|
|
37
|
-
return (String)this.get("binding");
|
|
38
|
-
} else {
|
|
39
|
-
return this.binding;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
public String getUserName() {
|
|
43
|
-
return (String)this.get("name");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|