cloudcc-cli 1.9.7 → 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 +7 -0
- package/java/com/cloudcc/core/CCService.java +64 -193
- package/java/com/cloudcc/core/CCTrigger.java +25 -12
- package/{core/core/CCTrigger.java → java/com/cloudcc/core/CCTriggerDemo.java} +4 -2
- package/java/com/cloudcc/core/CCTriggerHandler.java +5 -4
- package/java/com/cloudcc/core/SendEmail.java +3 -2
- package/java/com/cloudcc/core/Tool.java +110 -7
- package/java/com/cloudcc/core/TriggerInvoker.java +1 -0
- package/package.json +1 -1
- 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/CCService.java +0 -806
- package/core/core/CCTriggerHandler.java +0 -15
- package/core/core/DevLogger.java +0 -39
- package/core/core/OperatationEnum.java +0 -5
- package/core/core/PeakInterf.java +0 -6
- package/core/core/PeakSvc.java +0 -8
- package/core/core/ServiceResult.java +0 -35
- package/core/core/TriggerInvoker.java +0 -83
- package/core/core/TriggerMethod.java +0 -9
- package/core/core/TriggerTimeEnum.java +0 -5
- package/core/core/UserInfo.java +0 -45
- package/core/pom.xml +0 -75
package/README.md
CHANGED
|
@@ -14,21 +14,10 @@ import java.util.HashMap;
|
|
|
14
14
|
import java.util.List;
|
|
15
15
|
import java.util.Map;
|
|
16
16
|
|
|
17
|
-
import org.slf4j.Logger;
|
|
18
|
-
import org.slf4j.LoggerFactory;
|
|
19
|
-
|
|
20
17
|
import com.alibaba.fastjson.JSONArray;
|
|
21
18
|
import com.alibaba.fastjson.JSONObject;
|
|
22
|
-
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @author T.han
|
|
26
|
-
* @date 2023/8/17 15:09
|
|
27
|
-
* @project CloudccNewPro
|
|
28
|
-
* @Description //TODO
|
|
29
|
-
*/
|
|
30
|
-
public class CCService {
|
|
31
19
|
|
|
20
|
+
public class CCService {
|
|
32
21
|
public static UserInfo userInfo;
|
|
33
22
|
public String ACCESSTOKEN;
|
|
34
23
|
public String path;
|
|
@@ -39,7 +28,6 @@ public class CCService {
|
|
|
39
28
|
public ServiceResult trigger = new ServiceResult();
|
|
40
29
|
public String objectApiName;
|
|
41
30
|
String orgId = Config.get("orgId");
|
|
42
|
-
Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
43
31
|
|
|
44
32
|
public CCService(UserInfo userInfo) {
|
|
45
33
|
this.URL = Config.get("apiSvc");
|
|
@@ -47,22 +35,15 @@ public class CCService {
|
|
|
47
35
|
this.path = URL + "/openApi/common";
|
|
48
36
|
}
|
|
49
37
|
|
|
50
|
-
|
|
51
|
-
* @return java.util.List<com.cloudcc.newxm.util.CCObject>
|
|
52
|
-
* @Description //TODO cquery 查询不加条件
|
|
53
|
-
* @Author T.han
|
|
54
|
-
* @Date 2023/8/17 16:38
|
|
55
|
-
* @Param apiName 对象名
|
|
56
|
-
**/
|
|
38
|
+
@SuppressWarnings("rawtypes")
|
|
57
39
|
public List<CCObject> cquery(String apiName) {
|
|
58
40
|
List<CCObject> orst = new ArrayList<CCObject>();
|
|
59
|
-
// 拼接 parObj 参数
|
|
60
41
|
JSONObject parObj = new JSONObject();
|
|
61
|
-
parObj.put("serviceName", "cquery");
|
|
62
|
-
parObj.put("objectApiName", apiName);
|
|
63
|
-
parObj.put("expressions", "1=1");
|
|
64
|
-
parObj.put("isAddDelete", "false");
|
|
65
|
-
parObj.put("fields", "")
|
|
42
|
+
parObj.put("serviceName", "cquery");
|
|
43
|
+
parObj.put("objectApiName", apiName);
|
|
44
|
+
parObj.put("expressions", "1=1");
|
|
45
|
+
parObj.put("isAddDelete", "false");
|
|
46
|
+
parObj.put("fields", "");
|
|
66
47
|
|
|
67
48
|
String relStr = CCPost(path, parObj.toString());
|
|
68
49
|
JSONObject relObj = new JSONObject();
|
|
@@ -82,23 +63,15 @@ public class CCService {
|
|
|
82
63
|
return orst;
|
|
83
64
|
}
|
|
84
65
|
|
|
85
|
-
|
|
86
|
-
* @return java.util.List<com.cloudcc.newxm.util.CCObject>
|
|
87
|
-
* @Description //TODO cquery 查询方法
|
|
88
|
-
* @Author T.han
|
|
89
|
-
* @Date 2023/8/17 16:42
|
|
90
|
-
* @Param apiName 对象名
|
|
91
|
-
* @Param expression 查询条件
|
|
92
|
-
**/
|
|
66
|
+
@SuppressWarnings("rawtypes")
|
|
93
67
|
public List<CCObject> cquery(String apiName, String expression) {
|
|
94
68
|
List<CCObject> orst = new ArrayList<CCObject>();
|
|
95
|
-
// 拼接 parObj 参数
|
|
96
69
|
JSONObject parObj = new JSONObject();
|
|
97
|
-
parObj.put("serviceName", "cquery");
|
|
98
|
-
parObj.put("objectApiName", apiName);
|
|
99
|
-
parObj.put("expressions", expression);
|
|
100
|
-
parObj.put("isAddDelete", "false");
|
|
101
|
-
parObj.put("fields", "")
|
|
70
|
+
parObj.put("serviceName", "cquery");
|
|
71
|
+
parObj.put("objectApiName", apiName);
|
|
72
|
+
parObj.put("expressions", expression);
|
|
73
|
+
parObj.put("isAddDelete", "false");
|
|
74
|
+
parObj.put("fields", "");
|
|
102
75
|
|
|
103
76
|
String relStr = CCPost(path, parObj.toString());
|
|
104
77
|
JSONObject relObj = new JSONObject();
|
|
@@ -118,28 +91,20 @@ public class CCService {
|
|
|
118
91
|
return orst;
|
|
119
92
|
}
|
|
120
93
|
|
|
121
|
-
|
|
122
|
-
* @return java.util.List<com.cloudcc.newxm.util.CCObject>
|
|
123
|
-
* @Description //TODO cqlQuery 查询方法
|
|
124
|
-
* @Author T.han
|
|
125
|
-
* @Date 2023/8/17 16:41
|
|
126
|
-
* @Param apiName 对象名
|
|
127
|
-
* @Param expression 查询sql
|
|
128
|
-
**/
|
|
94
|
+
@SuppressWarnings("rawtypes")
|
|
129
95
|
public List<CCObject> cqlQuery(String apiName, String expression) {
|
|
130
96
|
List<CCObject> orst = new ArrayList<CCObject>();
|
|
131
|
-
// 拼接 parObj 参数
|
|
132
97
|
JSONObject parObj = new JSONObject();
|
|
133
|
-
parObj.put("serviceName", "cqlQueryWithLogInfo");
|
|
134
|
-
parObj.put("objectApiName", apiName);
|
|
135
|
-
parObj.put("expressions", expression);
|
|
98
|
+
parObj.put("serviceName", "cqlQueryWithLogInfo");
|
|
99
|
+
parObj.put("objectApiName", apiName);
|
|
100
|
+
parObj.put("expressions", expression);
|
|
136
101
|
String relStr = CCPost(path, parObj.toString());
|
|
137
102
|
JSONObject relObj = new JSONObject();
|
|
138
103
|
relObj = JSONObject.parseObject(relStr);
|
|
139
104
|
String result = relObj.getString("result");
|
|
140
105
|
if ("true".equals(result)) {
|
|
141
106
|
List<Map> rst = relObj.getJSONArray("data").toJavaList(Map.class);
|
|
142
|
-
for (Map
|
|
107
|
+
for (Map m : rst) {
|
|
143
108
|
CCObject co = new CCObject(apiName);
|
|
144
109
|
for (Object _key : m.keySet()) {
|
|
145
110
|
String key = (String) _key;
|
|
@@ -151,13 +116,6 @@ public class CCService {
|
|
|
151
116
|
return orst;
|
|
152
117
|
}
|
|
153
118
|
|
|
154
|
-
/**
|
|
155
|
-
* @Description //TODO update方法
|
|
156
|
-
* @Author T.han
|
|
157
|
-
* @Date 2023/8/18 10:02
|
|
158
|
-
* @Param cobj
|
|
159
|
-
* @return void
|
|
160
|
-
**/
|
|
161
119
|
public void update(CCObject cobj) {
|
|
162
120
|
JSONArray arry = new JSONArray();
|
|
163
121
|
JSONObject obj = new JSONObject();
|
|
@@ -172,11 +130,10 @@ public class CCService {
|
|
|
172
130
|
}
|
|
173
131
|
arry.add(obj);
|
|
174
132
|
|
|
175
|
-
// 拼接 parObj 参数
|
|
176
133
|
JSONObject parObj = new JSONObject();
|
|
177
|
-
parObj.put("serviceName", "update");
|
|
178
|
-
parObj.put("objectApiName", objectApiName);
|
|
179
|
-
parObj.put("data", arry.toString());
|
|
134
|
+
parObj.put("serviceName", "update");
|
|
135
|
+
parObj.put("objectApiName", objectApiName);
|
|
136
|
+
parObj.put("data", arry.toString());
|
|
180
137
|
try {
|
|
181
138
|
TriggerInvoker invoker = new TriggerInvoker(userInfo, "update", "before");
|
|
182
139
|
invoker.handler(cobj);
|
|
@@ -188,7 +145,7 @@ public class CCService {
|
|
|
188
145
|
if (outObj.containsKey("ids")) {
|
|
189
146
|
JSONArray outData = outObj.getJSONArray("ids");
|
|
190
147
|
StringBuilder sb = new StringBuilder();
|
|
191
|
-
boolean hasSuccess = false;
|
|
148
|
+
boolean hasSuccess = false;
|
|
192
149
|
for (int i = 0; i < outData.size(); i++) {
|
|
193
150
|
JSONObject acc = outData.getJSONObject(i);
|
|
194
151
|
if (acc.getBoolean("success")) {
|
|
@@ -199,37 +156,30 @@ public class CCService {
|
|
|
199
156
|
sb.append(id);
|
|
200
157
|
hasSuccess = true;
|
|
201
158
|
} else {
|
|
202
|
-
|
|
159
|
+
System.err.println("update报错: " + acc.getString("errors"));
|
|
203
160
|
}
|
|
204
161
|
}
|
|
205
162
|
if (hasSuccess) {
|
|
206
163
|
String retIds = sb.toString();
|
|
207
|
-
|
|
164
|
+
System.out.println("update成功: " + retIds);
|
|
208
165
|
cobj.put("id", retIds);
|
|
209
166
|
invoker = new TriggerInvoker(userInfo, "update", "before");
|
|
210
167
|
invoker.handler(cobj);
|
|
211
168
|
}
|
|
212
169
|
} else {
|
|
213
|
-
|
|
170
|
+
System.err.println("update未获取到ids 参数");
|
|
214
171
|
}
|
|
215
172
|
|
|
216
173
|
} else {
|
|
217
|
-
|
|
174
|
+
System.err.println("update报错= " + relObj.getString("returnInfo"));
|
|
218
175
|
}
|
|
219
176
|
|
|
220
177
|
} catch (Exception e) {
|
|
221
178
|
e.printStackTrace();
|
|
222
|
-
|
|
179
|
+
System.err.println("update报错= " + e);
|
|
223
180
|
}
|
|
224
181
|
}
|
|
225
182
|
|
|
226
|
-
/**
|
|
227
|
-
* @Description //TODO insert 方法
|
|
228
|
-
* @Author T.han
|
|
229
|
-
* @Date 2023/8/18 10:27
|
|
230
|
-
* @Param cobj 新建 json参数
|
|
231
|
-
* @return com.cloudcc.newxm.util.ServiceResult 返回新建数据id
|
|
232
|
-
**/
|
|
233
183
|
public ServiceResult insert(CCObject cobj) {
|
|
234
184
|
ServiceResult sr = new ServiceResult();
|
|
235
185
|
JSONArray arry = new JSONArray();
|
|
@@ -243,20 +193,17 @@ public class CCService {
|
|
|
243
193
|
obj.put(_key, values);
|
|
244
194
|
}
|
|
245
195
|
}
|
|
246
|
-
// cobj.remove("CCObjectAPI");
|
|
247
196
|
arry.add(obj);
|
|
248
|
-
// 拼接 parObj 参数
|
|
249
197
|
JSONObject parObj = new JSONObject();
|
|
250
|
-
parObj.put("serviceName", "insert");
|
|
251
|
-
parObj.put("objectApiName", objectApiName);
|
|
252
|
-
parObj.put("data", arry.toString());
|
|
253
|
-
|
|
198
|
+
parObj.put("serviceName", "insert");
|
|
199
|
+
parObj.put("objectApiName", objectApiName);
|
|
200
|
+
parObj.put("data", arry.toString());
|
|
201
|
+
System.out.println("parObj = " + parObj);
|
|
254
202
|
try {
|
|
255
|
-
// 执行触发器
|
|
256
203
|
TriggerInvoker invoker = new TriggerInvoker(userInfo, "insert", "before");
|
|
257
204
|
invoker.handler(cobj);
|
|
258
205
|
String relStr = CCPost(path, parObj.toString());
|
|
259
|
-
|
|
206
|
+
System.out.println("insert_relStr = " + relStr);
|
|
260
207
|
JSONObject relObj = JSONObject.parseObject(relStr);
|
|
261
208
|
|
|
262
209
|
String result = relObj.getString("result");
|
|
@@ -272,7 +219,7 @@ public class CCService {
|
|
|
272
219
|
}
|
|
273
220
|
sb.append(id);
|
|
274
221
|
} else {
|
|
275
|
-
|
|
222
|
+
System.err.println("insert报错: " + acc.getString("errors"));
|
|
276
223
|
}
|
|
277
224
|
}
|
|
278
225
|
String retIds = sb.toString();
|
|
@@ -290,7 +237,6 @@ public class CCService {
|
|
|
290
237
|
}
|
|
291
238
|
|
|
292
239
|
public ServiceResult insert(List<CCObject> datalist) {
|
|
293
|
-
// TODO Auto-generated method stub
|
|
294
240
|
ServiceResult sr = new ServiceResult();
|
|
295
241
|
JSONArray arry = new JSONArray();
|
|
296
242
|
JSONObject obj = new JSONObject();
|
|
@@ -307,15 +253,14 @@ public class CCService {
|
|
|
307
253
|
}
|
|
308
254
|
arry.add(obj);
|
|
309
255
|
}
|
|
310
|
-
// 拼接 parObj 参数
|
|
311
256
|
JSONObject parObj = new JSONObject();
|
|
312
|
-
parObj.put("serviceName", "insert");
|
|
313
|
-
parObj.put("objectApiName", objectApiName);
|
|
314
|
-
parObj.put("data", arry.toString());
|
|
257
|
+
parObj.put("serviceName", "insert");
|
|
258
|
+
parObj.put("objectApiName", objectApiName);
|
|
259
|
+
parObj.put("data", arry.toString());
|
|
315
260
|
System.out.println("parObj = " + parObj);
|
|
316
261
|
try {
|
|
317
262
|
String relStr = CCPost(path, parObj.toString());
|
|
318
|
-
|
|
263
|
+
System.out.println("insert_relStr = " + relStr);
|
|
319
264
|
JSONObject relObj = new JSONObject();
|
|
320
265
|
relObj = JSONObject.parseObject(relStr);
|
|
321
266
|
String result = relObj.getString("result");
|
|
@@ -331,7 +276,7 @@ public class CCService {
|
|
|
331
276
|
}
|
|
332
277
|
sb.append(id);
|
|
333
278
|
} else {
|
|
334
|
-
|
|
279
|
+
System.err.println("insert报错: " + acc.getString("errors"));
|
|
335
280
|
}
|
|
336
281
|
}
|
|
337
282
|
String retIds = sb.toString();
|
|
@@ -339,19 +284,12 @@ public class CCService {
|
|
|
339
284
|
}
|
|
340
285
|
} catch (Exception e) {
|
|
341
286
|
e.printStackTrace();
|
|
342
|
-
|
|
287
|
+
System.err.println("insert报错= " + e);
|
|
343
288
|
}
|
|
344
289
|
System.out.println("sr = " + sr);
|
|
345
290
|
return sr;
|
|
346
291
|
}
|
|
347
292
|
|
|
348
|
-
/**
|
|
349
|
-
* @Description
|
|
350
|
-
* @Author T.han
|
|
351
|
-
* @Date 2023/8/18 10:38
|
|
352
|
-
* @Param cobj 参数数据 {“id”:"a1231111"}
|
|
353
|
-
* @return void
|
|
354
|
-
**/
|
|
355
293
|
public void delete(CCObject cobj) {
|
|
356
294
|
JSONArray arry = new JSONArray();
|
|
357
295
|
JSONObject obj = new JSONObject();
|
|
@@ -365,21 +303,18 @@ public class CCService {
|
|
|
365
303
|
}
|
|
366
304
|
}
|
|
367
305
|
arry.add(obj);
|
|
368
|
-
// 拼接 parObj 参数
|
|
369
306
|
JSONObject parObj = new JSONObject();
|
|
370
|
-
parObj.put("serviceName", "delete");
|
|
371
|
-
parObj.put("objectApiName", objectApiName);
|
|
372
|
-
parObj.put("data", arry.toString());
|
|
307
|
+
parObj.put("serviceName", "delete");
|
|
308
|
+
parObj.put("objectApiName", objectApiName);
|
|
309
|
+
parObj.put("data", arry.toString());
|
|
373
310
|
System.out.println("parObj = " + parObj);
|
|
374
311
|
try {
|
|
375
312
|
TriggerInvoker invoker = new TriggerInvoker(userInfo, "delete", "before");
|
|
376
313
|
invoker.handler(cobj);
|
|
377
|
-
String relStr = CCPost(path, parObj.toString());
|
|
378
314
|
invoker = new TriggerInvoker(userInfo, "delete", "after");
|
|
379
315
|
invoker.handler(cobj);
|
|
380
316
|
} catch (Exception e) {
|
|
381
|
-
|
|
382
|
-
logger.error("delete报错= " + e);
|
|
317
|
+
System.err.println("delete报错= " + e);
|
|
383
318
|
}
|
|
384
319
|
}
|
|
385
320
|
|
|
@@ -397,11 +332,10 @@ public class CCService {
|
|
|
397
332
|
}
|
|
398
333
|
}
|
|
399
334
|
arry.add(obj);
|
|
400
|
-
// 拼接 parObj 参数
|
|
401
335
|
JSONObject parObj = new JSONObject();
|
|
402
|
-
parObj.put("serviceName", "upsert");
|
|
403
|
-
parObj.put("objectApiName", objectApiName);
|
|
404
|
-
parObj.put("data", arry.toString());
|
|
336
|
+
parObj.put("serviceName", "upsert");
|
|
337
|
+
parObj.put("objectApiName", objectApiName);
|
|
338
|
+
parObj.put("data", arry.toString());
|
|
405
339
|
try {
|
|
406
340
|
TriggerInvoker invoker = new TriggerInvoker(userInfo, "upsert", "before");
|
|
407
341
|
invoker.handler(cobj);
|
|
@@ -426,15 +360,6 @@ public class CCService {
|
|
|
426
360
|
return sr;
|
|
427
361
|
}
|
|
428
362
|
|
|
429
|
-
/**
|
|
430
|
-
* @Description //TODO post请求
|
|
431
|
-
* @Author T.han
|
|
432
|
-
* @Date 2023/8/18 10:03
|
|
433
|
-
* @Param path 接口地址 http://127.0.0.1/cloudcc/outken
|
|
434
|
-
* @Param param 参数 json
|
|
435
|
-
* @Param IsToken headers是否添加token false:不添加 true:添加
|
|
436
|
-
* @return java.lang.String
|
|
437
|
-
**/
|
|
438
363
|
public String sendPost(String path, String param) {
|
|
439
364
|
OutputStreamWriter out = null;
|
|
440
365
|
BufferedReader br = null;
|
|
@@ -444,27 +369,19 @@ public class CCService {
|
|
|
444
369
|
try {
|
|
445
370
|
URL url = new URL(path);
|
|
446
371
|
HttpURLConnection conn = null;
|
|
447
|
-
// 打开和URL之间的连接
|
|
448
372
|
conn = (HttpURLConnection) url.openConnection();
|
|
449
|
-
// 发送POST请求必须设置如下两行
|
|
450
373
|
conn.setDoOutput(true);
|
|
451
374
|
conn.setDoInput(true);
|
|
452
|
-
conn.setRequestMethod("POST");
|
|
453
|
-
conn.setConnectTimeout(15 * 1000)
|
|
454
|
-
conn.setReadTimeout(20 * 1000)
|
|
455
|
-
String tokens = "";
|
|
456
|
-
// 设置通用的请求属性
|
|
375
|
+
conn.setRequestMethod("POST");
|
|
376
|
+
conn.setConnectTimeout(15 * 1000);
|
|
377
|
+
conn.setReadTimeout(20 * 1000);
|
|
457
378
|
conn.setRequestProperty("Content-Type", "application/json");
|
|
458
379
|
conn.setRequestProperty("accept", "*/*");
|
|
459
380
|
conn.connect();
|
|
460
|
-
// 获取URLConnection对象对应的输出流
|
|
461
381
|
out = new OutputStreamWriter(conn.getOutputStream());
|
|
462
|
-
// 发送请求参数
|
|
463
382
|
BufferedWriter bw = new BufferedWriter(out);
|
|
464
383
|
bw.write(param);
|
|
465
|
-
// flush输出流的缓冲
|
|
466
384
|
bw.flush();
|
|
467
|
-
// 定义BufferedReader输入流来读取URL的响应
|
|
468
385
|
br = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
|
|
469
386
|
String line;
|
|
470
387
|
while ((line = br.readLine()) != null) {
|
|
@@ -503,28 +420,20 @@ public class CCService {
|
|
|
503
420
|
try {
|
|
504
421
|
URL url = new URL(path);
|
|
505
422
|
HttpURLConnection conn = null;
|
|
506
|
-
// 打开和URL之间的连接
|
|
507
423
|
conn = (HttpURLConnection) url.openConnection();
|
|
508
|
-
// 发送POST请求必须设置如下两行
|
|
509
424
|
conn.setDoOutput(true);
|
|
510
425
|
conn.setDoInput(true);
|
|
511
|
-
conn.setRequestMethod("POST");
|
|
512
|
-
conn.setConnectTimeout(15 * 1000)
|
|
513
|
-
conn.setReadTimeout(20 * 1000)
|
|
514
|
-
String tokens = "";
|
|
515
|
-
// 设置通用的请求属性
|
|
426
|
+
conn.setRequestMethod("POST");
|
|
427
|
+
conn.setConnectTimeout(15 * 1000);
|
|
428
|
+
conn.setReadTimeout(20 * 1000);
|
|
516
429
|
conn.setRequestProperty("Content-Type", "application/json");
|
|
517
430
|
conn.setRequestProperty("accept", "*/*");
|
|
518
431
|
conn.setRequestProperty("accessToken", ACCESSTOKEN);
|
|
519
432
|
conn.connect();
|
|
520
|
-
// 获取URLConnection对象对应的输出流
|
|
521
433
|
out = new OutputStreamWriter(conn.getOutputStream());
|
|
522
|
-
// 发送请求参数
|
|
523
434
|
BufferedWriter bw = new BufferedWriter(out);
|
|
524
435
|
bw.write(param);
|
|
525
|
-
// flush输出流的缓冲
|
|
526
436
|
bw.flush();
|
|
527
|
-
// 定义BufferedReader输入流来读取URL的响应
|
|
528
437
|
br = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
|
|
529
438
|
String line;
|
|
530
439
|
while ((line = br.readLine()) != null) {
|
|
@@ -554,13 +463,6 @@ public class CCService {
|
|
|
554
463
|
return result;
|
|
555
464
|
}
|
|
556
465
|
|
|
557
|
-
/**
|
|
558
|
-
* @Description //TODO GET请求方法
|
|
559
|
-
* @Author T.han
|
|
560
|
-
* @Date 2023/8/18 10:06
|
|
561
|
-
* @Param path 地址 http://127.0.0.1/cloudcc/outoken?key1=value1&key2=value2
|
|
562
|
-
* @return java.lang.String
|
|
563
|
-
**/
|
|
564
466
|
public static String sendGet(String path) {
|
|
565
467
|
StringBuffer sb = new StringBuffer();
|
|
566
468
|
String exception = "";
|
|
@@ -570,7 +472,7 @@ public class CCService {
|
|
|
570
472
|
InputStream is = url.openStream();
|
|
571
473
|
InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8);
|
|
572
474
|
BufferedReader br = new BufferedReader(isr);
|
|
573
|
-
String line
|
|
475
|
+
String line;
|
|
574
476
|
while ((line = br.readLine()) != null) {
|
|
575
477
|
sb.append(line);
|
|
576
478
|
}
|
|
@@ -589,18 +491,8 @@ public class CCService {
|
|
|
589
491
|
return result;
|
|
590
492
|
}
|
|
591
493
|
|
|
592
|
-
/**
|
|
593
|
-
* 获取自定义列表设置
|
|
594
|
-
*
|
|
595
|
-
* @param api 接口名称,用于指定获取哪个接口的自定义设置
|
|
596
|
-
* @return 返回一个包含自定义设置数据的Map对象
|
|
597
|
-
*/
|
|
598
494
|
public Map<String, Object> getListCustomSetting(String api) {
|
|
599
|
-
|
|
600
|
-
// 初始化数据映射对象,用于存放最终返回的数据
|
|
601
495
|
Map<String, Object> datMap = new HashMap<String, Object>();
|
|
602
|
-
|
|
603
|
-
// 创建参数数组,用于存放调用接口的参数
|
|
604
496
|
JSONArray argArray = new JSONArray();
|
|
605
497
|
JSONObject arryStr = new JSONObject();
|
|
606
498
|
arryStr.put("argType", String.class);
|
|
@@ -608,33 +500,20 @@ public class CCService {
|
|
|
608
500
|
argArray.add(arryStr);
|
|
609
501
|
|
|
610
502
|
JSONObject parObj = new JSONObject();
|
|
611
|
-
parObj.put("className", "upsert");
|
|
612
|
-
parObj.put("methodName", "getListCustomSetting");
|
|
613
|
-
parObj.put("params", argArray);
|
|
503
|
+
parObj.put("className", "upsert");
|
|
504
|
+
parObj.put("methodName", "getListCustomSetting");
|
|
505
|
+
parObj.put("params", argArray);
|
|
614
506
|
try {
|
|
615
507
|
String relStr = CCPost(path, parObj.toString());
|
|
616
508
|
JSONObject.parseObject(relStr);
|
|
617
|
-
ObjectMapper objectMapper = new ObjectMapper();
|
|
618
|
-
// 将对象描述转换为字符串并添加到结果中
|
|
619
|
-
// datMap = objectMapper.convertValue(objectMapper, Map.class);
|
|
620
509
|
} catch (Exception e) {
|
|
621
510
|
e.printStackTrace();
|
|
622
|
-
|
|
511
|
+
System.err.println("upsert报错= " + e);
|
|
623
512
|
}
|
|
624
513
|
|
|
625
514
|
return datMap;
|
|
626
515
|
}
|
|
627
516
|
|
|
628
|
-
/**
|
|
629
|
-
* 获取自定义设置列表。
|
|
630
|
-
* 通过调用指定API和键值,来获取相应的自定义设置数据。
|
|
631
|
-
*
|
|
632
|
-
* @author admin
|
|
633
|
-
* @Version Created on 2024.4.10
|
|
634
|
-
* @param api 要调用的API名称。
|
|
635
|
-
* @param key 查询设置列表时使用的键值。
|
|
636
|
-
* @return 返回一个包含自定义设置数据的Map对象。如果发生错误,可能返回空或错误信息的Map。
|
|
637
|
-
*/
|
|
638
517
|
public Map<String, Object> getListCustomSetting(String api, String key) {
|
|
639
518
|
Map<String, Object> datMap = new HashMap<String, Object>();
|
|
640
519
|
JSONArray argArray = new JSONArray();
|
|
@@ -650,25 +529,22 @@ public class CCService {
|
|
|
650
529
|
argArray.add(keyParam);
|
|
651
530
|
|
|
652
531
|
JSONObject parObj = new JSONObject();
|
|
653
|
-
parObj.put("className", "TCCCustomSetting");
|
|
654
|
-
parObj.put("methodName", "getListCustomSetting");
|
|
655
|
-
parObj.put("params", argArray);
|
|
532
|
+
parObj.put("className", "TCCCustomSetting");
|
|
533
|
+
parObj.put("methodName", "getListCustomSetting");
|
|
534
|
+
parObj.put("params", argArray);
|
|
656
535
|
|
|
657
536
|
try {
|
|
658
537
|
String relStr = CCPost(path, parObj.toString());
|
|
659
538
|
JSONObject.parseObject(relStr);
|
|
660
|
-
ObjectMapper objectMapper = new ObjectMapper();
|
|
661
|
-
// 将对象描述转换为字符串并添加到结果中
|
|
662
|
-
// datMap = objectMapper.convertValue(objectMapper, Map.class);
|
|
663
539
|
} catch (Exception e) {
|
|
664
540
|
e.printStackTrace();
|
|
665
|
-
|
|
541
|
+
System.err.println("upsert报错= " + e);
|
|
666
542
|
}
|
|
667
543
|
|
|
668
544
|
return datMap;
|
|
669
545
|
}
|
|
670
546
|
|
|
671
|
-
public
|
|
547
|
+
public HashMap<String, Object> cqueryForEs(String account, String where, String aTrue, String s) {
|
|
672
548
|
return null;
|
|
673
549
|
}
|
|
674
550
|
|
|
@@ -684,7 +560,7 @@ public class CCService {
|
|
|
684
560
|
return null;
|
|
685
561
|
}
|
|
686
562
|
|
|
687
|
-
public void addCaseTeam(List<
|
|
563
|
+
public void addCaseTeam(List<HashMap<String, Object>> caseteamList, String recordid) {
|
|
688
564
|
}
|
|
689
565
|
|
|
690
566
|
public ServiceResult update(CCObject serv, boolean b, boolean b1, boolean b2, boolean b3) {
|
|
@@ -692,7 +568,6 @@ public class CCService {
|
|
|
692
568
|
}
|
|
693
569
|
|
|
694
570
|
public ServiceResult insertLt(CCObject in) throws Exception {
|
|
695
|
-
// TODO Auto-generated method stub
|
|
696
571
|
List<CCObject> datalist = new ArrayList<CCObject>();
|
|
697
572
|
datalist.add(in);
|
|
698
573
|
insert(datalist);
|
|
@@ -700,16 +575,12 @@ public class CCService {
|
|
|
700
575
|
}
|
|
701
576
|
|
|
702
577
|
public ServiceResult updateLt(CCObject objectData) throws Exception {
|
|
703
|
-
// TODO Auto-generated method stub
|
|
704
|
-
// 不执行触发器
|
|
705
578
|
return null;
|
|
706
579
|
}
|
|
707
580
|
|
|
708
581
|
public void addMicroPost(String string, Object object, Object object2, Object object3, Object object4,
|
|
709
582
|
Object object5, Object object6, String string2, String emailSubject, String string3, String stkhid,
|
|
710
583
|
String stkhid2) {
|
|
711
|
-
// TODO Auto-generated method stub
|
|
712
|
-
|
|
713
584
|
}
|
|
714
585
|
|
|
715
586
|
public String sendEmail(String subject, String htmlBody, String toAddress, String relatedid, String ccaddress,
|
|
@@ -717,7 +588,7 @@ public class CCService {
|
|
|
717
588
|
return "";
|
|
718
589
|
}
|
|
719
590
|
|
|
720
|
-
public String uploadAttachment(
|
|
591
|
+
public String uploadAttachment(HashMap<String, Object> m) {
|
|
721
592
|
return null;
|
|
722
593
|
}
|
|
723
594
|
|
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
package com.cloudcc.core;
|
|
2
2
|
|
|
3
|
-
public
|
|
4
|
-
public void do_insert_before() throws Exception;
|
|
3
|
+
public class CCTrigger {
|
|
5
4
|
|
|
6
|
-
public void
|
|
5
|
+
public void do_insert_before() throws Exception {
|
|
6
|
+
}
|
|
7
7
|
|
|
8
|
-
public void
|
|
8
|
+
public void do_insert_after() throws Exception {
|
|
9
|
+
}
|
|
9
10
|
|
|
10
|
-
public void
|
|
11
|
+
public void do_update_before() throws Exception {
|
|
12
|
+
}
|
|
11
13
|
|
|
12
|
-
public void
|
|
14
|
+
public void do_update_after() throws Exception {
|
|
15
|
+
}
|
|
13
16
|
|
|
14
|
-
public void
|
|
17
|
+
public void do_upsert_before() throws Exception {
|
|
18
|
+
}
|
|
15
19
|
|
|
16
|
-
public void
|
|
20
|
+
public void do_upsert_after() throws Exception {
|
|
21
|
+
}
|
|
17
22
|
|
|
18
|
-
public void
|
|
23
|
+
public void do_delete_before() throws Exception {
|
|
24
|
+
}
|
|
19
25
|
|
|
20
|
-
public void
|
|
26
|
+
public void do_delete_after() throws Exception {
|
|
27
|
+
}
|
|
21
28
|
|
|
22
|
-
public void
|
|
29
|
+
public void setRecordOldVal(String id) {
|
|
30
|
+
}
|
|
23
31
|
|
|
24
|
-
public
|
|
32
|
+
public void do_approval() throws Exception {
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public String getObjectApiName() {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
25
38
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
package com.cloudcc.core;
|
|
2
2
|
|
|
3
|
-
public interface
|
|
3
|
+
public interface CCTriggerDemo {
|
|
4
4
|
public void do_insert_before() throws Exception;
|
|
5
5
|
|
|
6
6
|
public void do_insert_after() throws Exception;
|
|
@@ -8,6 +8,7 @@ public interface CCTrigger {
|
|
|
8
8
|
public void do_update_before() throws Exception;
|
|
9
9
|
|
|
10
10
|
public void do_update_after() throws Exception;
|
|
11
|
+
|
|
11
12
|
public void do_upsert_before() throws Exception;
|
|
12
13
|
|
|
13
14
|
public void do_upsert_after() throws Exception;
|
|
@@ -15,7 +16,8 @@ public interface CCTrigger {
|
|
|
15
16
|
public void do_delete_before() throws Exception;
|
|
16
17
|
|
|
17
18
|
public void do_delete_after() throws Exception;
|
|
18
|
-
|
|
19
|
+
|
|
20
|
+
public void setRecordOldVal(String id);
|
|
19
21
|
|
|
20
22
|
public void do_approval() throws Exception;
|
|
21
23
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
package com.cloudcc.core;
|
|
2
2
|
|
|
3
|
-
import java.util.
|
|
3
|
+
import java.util.HashMap;
|
|
4
4
|
|
|
5
5
|
public abstract class CCTriggerHandler extends CCService {
|
|
6
|
-
public
|
|
7
|
-
public
|
|
6
|
+
public HashMap<String, Object> record_new;
|
|
7
|
+
public HashMap<String, Object> record_old;
|
|
8
8
|
public ServiceResult trigger;
|
|
9
9
|
|
|
10
|
-
public CCTriggerHandler(
|
|
10
|
+
public CCTriggerHandler(HashMap<String, Object> triggernew, HashMap<String, Object> triggerold, ServiceResult svc,
|
|
11
|
+
UserInfo uinfo) {
|
|
11
12
|
super(uinfo);
|
|
12
13
|
this.record_new = triggernew;
|
|
13
14
|
this.record_old = triggerold;
|