cloudcc-cli 1.9.6 → 1.9.7

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.
@@ -0,0 +1,740 @@
1
+ package com.cloudcc.core;
2
+
3
+ import java.io.BufferedReader;
4
+ import java.io.BufferedWriter;
5
+ import java.io.IOException;
6
+ import java.io.InputStream;
7
+ import java.io.InputStreamReader;
8
+ import java.io.OutputStreamWriter;
9
+ import java.net.HttpURLConnection;
10
+ import java.net.URL;
11
+ import java.nio.charset.StandardCharsets;
12
+ import java.util.ArrayList;
13
+ import java.util.HashMap;
14
+ import java.util.List;
15
+ import java.util.Map;
16
+
17
+ import org.slf4j.Logger;
18
+ import org.slf4j.LoggerFactory;
19
+
20
+ import com.alibaba.fastjson.JSONArray;
21
+ 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
+
32
+ public static UserInfo userInfo;
33
+ public String ACCESSTOKEN;
34
+ public String path;
35
+ public String URL;
36
+ protected Map<String, Object> record_new;
37
+ protected Map<String, Object> record_old;
38
+ public Map<String, String> Config = Tool.getConfig();
39
+ public ServiceResult trigger = new ServiceResult();
40
+ public String objectApiName;
41
+ String orgId = Config.get("orgId");
42
+ Logger logger = LoggerFactory.getLogger(this.getClass());
43
+
44
+ public CCService(UserInfo userInfo) {
45
+ this.URL = Config.get("apiSvc");
46
+ this.ACCESSTOKEN = Config.get("token");
47
+ this.path = URL + "/openApi/common";
48
+ }
49
+
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
+ **/
57
+ public List<CCObject> cquery(String apiName) {
58
+ List<CCObject> orst = new ArrayList<CCObject>();
59
+ // 拼接 parObj 参数
60
+ 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"); // 是否包含删除数据 true:包含 false:不包含
65
+ parObj.put("fields", "");// 查询字段 不填写时sql按 * 返回
66
+
67
+ String relStr = CCPost(path, parObj.toString());
68
+ JSONObject relObj = new JSONObject();
69
+ relObj = JSONObject.parseObject(relStr);
70
+ String result = relObj.getString("result");
71
+ if ("true".equals(result)) {
72
+ List<Map> rst = relObj.getJSONArray("data").toJavaList(Map.class);
73
+ for (Map m : rst) {
74
+ CCObject co = new CCObject(apiName);
75
+ for (Object _key : m.keySet()) {
76
+ String key = (String) _key;
77
+ co.put(key, m.get(key));
78
+ }
79
+ orst.add(co);
80
+ }
81
+ }
82
+ return orst;
83
+ }
84
+
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
+ **/
93
+ public List<CCObject> cquery(String apiName, String expression) {
94
+ List<CCObject> orst = new ArrayList<CCObject>();
95
+ // 拼接 parObj 参数
96
+ JSONObject parObj = new JSONObject();
97
+ parObj.put("serviceName", "cquery"); // 服务名
98
+ parObj.put("objectApiName", apiName); // 对象名
99
+ parObj.put("expressions", expression); // 查询条件
100
+ parObj.put("isAddDelete", "false"); // 是否包含删除数据 true:包含 false:不包含
101
+ parObj.put("fields", "");// 查询字段 不填写时sql按 * 返回
102
+
103
+ String relStr = CCPost(path, parObj.toString());
104
+ JSONObject relObj = new JSONObject();
105
+ relObj = JSONObject.parseObject(relStr);
106
+ String result = relObj.getString("result");
107
+ if ("true".equals(result)) {
108
+ List<Map> rst = relObj.getJSONArray("data").toJavaList(Map.class);
109
+ for (Map m : rst) {
110
+ CCObject co = new CCObject(apiName);
111
+ for (Object _key : m.keySet()) {
112
+ String key = (String) _key;
113
+ co.put(key, m.get(key));
114
+ }
115
+ orst.add(co);
116
+ }
117
+ }
118
+ return orst;
119
+ }
120
+
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
+ **/
129
+ public List<CCObject> cqlQuery(String apiName, String expression) {
130
+ List<CCObject> orst = new ArrayList<CCObject>();
131
+ // 拼接 parObj 参数
132
+ JSONObject parObj = new JSONObject();
133
+ parObj.put("serviceName", "cqlQueryWithLogInfo"); // 服务名
134
+ parObj.put("objectApiName", apiName); // 对象名
135
+ parObj.put("expressions", expression); // 查询条件
136
+ String relStr = CCPost(path, parObj.toString());
137
+ JSONObject relObj = new JSONObject();
138
+ relObj = JSONObject.parseObject(relStr);
139
+ String result = relObj.getString("result");
140
+ if ("true".equals(result)) {
141
+ List<Map> rst = relObj.getJSONArray("data").toJavaList(Map.class);
142
+ for (Map<String, Object> m : rst) {
143
+ CCObject co = new CCObject(apiName);
144
+ for (Object _key : m.keySet()) {
145
+ String key = (String) _key;
146
+ co.put(key, m.get(key));
147
+ }
148
+ orst.add(co);
149
+ }
150
+ }
151
+ return orst;
152
+ }
153
+
154
+ /**
155
+ * @Description //TODO update方法
156
+ * @Author T.han
157
+ * @Date 2023/8/18 10:02
158
+ * @Param cobj
159
+ * @return void
160
+ **/
161
+ public void update(CCObject cobj) {
162
+ JSONArray arry = new JSONArray();
163
+ JSONObject obj = new JSONObject();
164
+ String objectApiName = "";
165
+ for (String _key : cobj.keySet()) {
166
+ if ("CCObjectAPI".equals(_key)) {
167
+ objectApiName = cobj.get("CCObjectAPI") == null ? "" : cobj.get("CCObjectAPI") + "";
168
+ } else {
169
+ String values = cobj.get(_key) == null ? "" : cobj.get(_key) + "";
170
+ obj.put(_key, values);
171
+ }
172
+ }
173
+ arry.add(obj);
174
+
175
+ // 拼接 parObj 参数
176
+ JSONObject parObj = new JSONObject();
177
+ parObj.put("serviceName", "update"); // 服务名
178
+ parObj.put("objectApiName", objectApiName); // 对象名
179
+ parObj.put("data", arry.toString()); // 查询条件
180
+ try {
181
+ TriggerInvoker invoker = new TriggerInvoker(userInfo, "update", "before");
182
+ invoker.handler(cobj);
183
+ String relStr = CCPost(path, parObj.toString());
184
+ JSONObject relObj = JSONObject.parseObject(relStr);
185
+ boolean result = relObj.getBoolean("result");
186
+ if (result) {
187
+ JSONObject outObj = relObj.getJSONObject("data");
188
+ if (outObj.containsKey("ids")) {
189
+ JSONArray outData = outObj.getJSONArray("ids");
190
+ StringBuilder sb = new StringBuilder();
191
+ boolean hasSuccess = false; // 用于跟踪是否有成功处理的条目
192
+ for (int i = 0; i < outData.size(); i++) {
193
+ JSONObject acc = outData.getJSONObject(i);
194
+ if (acc.getBoolean("success")) {
195
+ String id = acc.getString("id");
196
+ if (sb.length() > 0) {
197
+ sb.append(',');
198
+ }
199
+ sb.append(id);
200
+ hasSuccess = true;
201
+ } else {
202
+ logger.error("update报错: " + acc.getString("errors"));
203
+ }
204
+ }
205
+ if (hasSuccess) {
206
+ String retIds = sb.toString();
207
+ logger.info("update成功: " + retIds);
208
+ cobj.put("id", retIds);
209
+ invoker = new TriggerInvoker(userInfo, "update", "before");
210
+ invoker.handler(cobj);
211
+ }
212
+ } else {
213
+ logger.error("update未获取到ids 参数");
214
+ }
215
+
216
+ } else {
217
+ logger.error("update报错= " + relObj.getString("returnInfo"));
218
+ }
219
+
220
+ } catch (Exception e) {
221
+ e.printStackTrace();
222
+ logger.error("update报错= " + e);
223
+ }
224
+ }
225
+
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
+ public ServiceResult insert(CCObject cobj) {
234
+ ServiceResult sr = new ServiceResult();
235
+ JSONArray arry = new JSONArray();
236
+ JSONObject obj = new JSONObject();
237
+ String objectApiName = "";
238
+ for (String _key : cobj.keySet()) {
239
+ if ("CCObjectAPI".equals(_key)) {
240
+ objectApiName = cobj.get("CCObjectAPI") == null ? "" : cobj.get("CCObjectAPI") + "";
241
+ } else {
242
+ String values = cobj.get(_key) == null ? "" : cobj.get(_key) + "";
243
+ obj.put(_key, values);
244
+ }
245
+ }
246
+ // cobj.remove("CCObjectAPI");
247
+ arry.add(obj);
248
+ // 拼接 parObj 参数
249
+ JSONObject parObj = new JSONObject();
250
+ parObj.put("serviceName", "insert"); // 服务名
251
+ parObj.put("objectApiName", objectApiName); // 对象名
252
+ parObj.put("data", arry.toString()); // 查询条件
253
+ logger.info("parObj = " + parObj);
254
+ try {
255
+ // 执行触发器
256
+ TriggerInvoker invoker = new TriggerInvoker(userInfo, "insert", "before");
257
+ invoker.handler(cobj);
258
+ String relStr = CCPost(path, parObj.toString());
259
+ logger.info("insert_relStr = " + relStr);
260
+ JSONObject relObj = JSONObject.parseObject(relStr);
261
+
262
+ String result = relObj.getString("result");
263
+ if ("true".equals(result)) {
264
+ JSONArray outData = relObj.getJSONObject("data").getJSONArray("ids");
265
+ StringBuilder sb = new StringBuilder();
266
+ for (int i = 0; i < outData.size(); i++) {
267
+ JSONObject acc = outData.getJSONObject(i);
268
+ if (acc.getBoolean("success")) {
269
+ String id = acc.getString("id");
270
+ if (sb.length() > 0) {
271
+ sb.append(',');
272
+ }
273
+ sb.append(id);
274
+ } else {
275
+ logger.error("insert报错: " + acc.getString("errors"));
276
+ }
277
+ }
278
+ String retIds = sb.toString();
279
+ sr.put("id", retIds);
280
+ cobj.put("id", retIds);
281
+ invoker = new TriggerInvoker(userInfo, "insert", "after");
282
+ invoker.handler(cobj);
283
+ }
284
+ } catch (Exception e) {
285
+ e.printStackTrace();
286
+ System.out.println("insert报错= " + e);
287
+ }
288
+ System.out.println("sr = " + sr);
289
+ return sr;
290
+ }
291
+
292
+ public ServiceResult insert(List<CCObject> datalist) {
293
+ // TODO Auto-generated method stub
294
+ ServiceResult sr = new ServiceResult();
295
+ JSONArray arry = new JSONArray();
296
+ JSONObject obj = new JSONObject();
297
+ String objectApiName = "";
298
+
299
+ for (CCObject cobj : datalist) {
300
+ for (String _key : cobj.keySet()) {
301
+ if ("CCObjectAPI".equals(_key)) {
302
+ objectApiName = cobj.get("CCObjectAPI") == null ? "" : cobj.get("CCObjectAPI") + "";
303
+ } else {
304
+ String values = cobj.get(_key) == null ? "" : cobj.get(_key) + "";
305
+ obj.put(_key, values);
306
+ }
307
+ }
308
+ arry.add(obj);
309
+ }
310
+ // 拼接 parObj 参数
311
+ JSONObject parObj = new JSONObject();
312
+ parObj.put("serviceName", "insert"); // 服务名
313
+ parObj.put("objectApiName", objectApiName); // 对象名
314
+ parObj.put("data", arry.toString()); // 查询条件
315
+ System.out.println("parObj = " + parObj);
316
+ try {
317
+ String relStr = CCPost(path, parObj.toString());
318
+ logger.info("insert_relStr = " + relStr);
319
+ JSONObject relObj = new JSONObject();
320
+ relObj = JSONObject.parseObject(relStr);
321
+ String result = relObj.getString("result");
322
+ if ("true".equals(result)) {
323
+ JSONArray outData = relObj.getJSONObject("data").getJSONArray("ids");
324
+ StringBuilder sb = new StringBuilder();
325
+ for (int i = 0; i < outData.size(); i++) {
326
+ JSONObject acc = outData.getJSONObject(i);
327
+ if (acc.getBoolean("success")) {
328
+ String id = acc.getString("id");
329
+ if (sb.length() > 0) {
330
+ sb.append(',');
331
+ }
332
+ sb.append(id);
333
+ } else {
334
+ logger.error("insert报错: " + acc.getString("errors"));
335
+ }
336
+ }
337
+ String retIds = sb.toString();
338
+ sr.put("id", retIds);
339
+ }
340
+ } catch (Exception e) {
341
+ e.printStackTrace();
342
+ logger.error("insert报错= " + e);
343
+ }
344
+ System.out.println("sr = " + sr);
345
+ return sr;
346
+ }
347
+
348
+ /**
349
+ * @Description
350
+ * @Author T.han
351
+ * @Date 2023/8/18 10:38
352
+ * @Param cobj 参数数据 {“id”:"a1231111"}
353
+ * @return void
354
+ **/
355
+ public void delete(CCObject cobj) {
356
+ JSONArray arry = new JSONArray();
357
+ JSONObject obj = new JSONObject();
358
+ String objectApiName = "";
359
+ for (String _key : cobj.keySet()) {
360
+ if ("CCObjectAPI".equals(_key)) {
361
+ objectApiName = cobj.get("CCObjectAPI") == null ? "" : cobj.get("CCObjectAPI") + "";
362
+ } else {
363
+ String values = cobj.get(_key) == null ? "" : cobj.get(_key) + "";
364
+ obj.put(_key, values);
365
+ }
366
+ }
367
+ arry.add(obj);
368
+ // 拼接 parObj 参数
369
+ JSONObject parObj = new JSONObject();
370
+ parObj.put("serviceName", "delete"); // 服务名
371
+ parObj.put("objectApiName", objectApiName); // 对象名
372
+ parObj.put("data", arry.toString()); // 查询条件
373
+ System.out.println("parObj = " + parObj);
374
+ try {
375
+ TriggerInvoker invoker = new TriggerInvoker(userInfo, "delete", "before");
376
+ invoker.handler(cobj);
377
+ String relStr = CCPost(path, parObj.toString());
378
+ invoker = new TriggerInvoker(userInfo, "delete", "after");
379
+ invoker.handler(cobj);
380
+ } catch (Exception e) {
381
+ // e.printStackTrace();
382
+ logger.error("delete报错= " + e);
383
+ }
384
+ }
385
+
386
+ public ServiceResult upsert(CCObject cobj) {
387
+ ServiceResult sr = new ServiceResult();
388
+ JSONArray arry = new JSONArray();
389
+ JSONObject obj = new JSONObject();
390
+ String objectApiName = "";
391
+ for (String _key : cobj.keySet()) {
392
+ if ("CCObjectAPI".equals(_key)) {
393
+ objectApiName = cobj.get("CCObjectAPI") == null ? "" : cobj.get("CCObjectAPI") + "";
394
+ } else {
395
+ String values = cobj.get(_key) == null ? "" : cobj.get(_key) + "";
396
+ obj.put(_key, values);
397
+ }
398
+ }
399
+ arry.add(obj);
400
+ // 拼接 parObj 参数
401
+ JSONObject parObj = new JSONObject();
402
+ parObj.put("serviceName", "upsert"); // 服务名
403
+ parObj.put("objectApiName", objectApiName); // 对象名
404
+ parObj.put("data", arry.toString()); // 查询条件
405
+ try {
406
+ TriggerInvoker invoker = new TriggerInvoker(userInfo, "upsert", "before");
407
+ invoker.handler(cobj);
408
+ String relStr = CCPost(path, parObj.toString());
409
+ JSONObject relObj = new JSONObject();
410
+ relObj = JSONObject.parseObject(relStr);
411
+ String result = relObj.getString("result");
412
+ if ("true".equals(result)) {
413
+ JSONArray outData = relObj.getJSONObject("data").getJSONArray("ids");
414
+ JSONObject acc = outData.getJSONObject(0);
415
+ if (acc.getBoolean("success")) {
416
+ sr.put("id", acc.getString("id"));
417
+ cobj.put("id", acc.getString("id"));
418
+ }
419
+ invoker = new TriggerInvoker(userInfo, "upsert", "before");
420
+ invoker.handler(cobj);
421
+ }
422
+ } catch (Exception e) {
423
+ e.printStackTrace();
424
+ System.out.println("upsert报错= " + e);
425
+ }
426
+ return sr;
427
+ }
428
+
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
+ public String sendPost(String path, String param) {
439
+ OutputStreamWriter out = null;
440
+ BufferedReader br = null;
441
+ StringBuffer sb = new StringBuffer();
442
+ String exception = "";
443
+ String result = "";
444
+ try {
445
+ URL url = new URL(path);
446
+ HttpURLConnection conn = null;
447
+ // 打开和URL之间的连接
448
+ conn = (HttpURLConnection) url.openConnection();
449
+ // 发送POST请求必须设置如下两行
450
+ conn.setDoOutput(true);
451
+ conn.setDoInput(true);
452
+ conn.setRequestMethod("POST"); // POST方法
453
+ conn.setConnectTimeout(15 * 1000);// 设置连接超时时间为5秒
454
+ conn.setReadTimeout(20 * 1000);// 设置读取超时时间为20秒
455
+ String tokens = "";
456
+ // 设置通用的请求属性
457
+ conn.setRequestProperty("Content-Type", "application/json");
458
+ conn.setRequestProperty("accept", "*/*");
459
+ conn.connect();
460
+ // 获取URLConnection对象对应的输出流
461
+ out = new OutputStreamWriter(conn.getOutputStream());
462
+ // 发送请求参数
463
+ BufferedWriter bw = new BufferedWriter(out);
464
+ bw.write(param);
465
+ // flush输出流的缓冲
466
+ bw.flush();
467
+ // 定义BufferedReader输入流来读取URL的响应
468
+ br = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
469
+ String line;
470
+ while ((line = br.readLine()) != null) {
471
+ sb.append(line);
472
+ }
473
+ } catch (Exception e) {
474
+ System.out.println("发送 POST 请求出现异常!" + e);
475
+ exception = "发送 POST 请求出现异常!" + e;
476
+ e.printStackTrace();
477
+ } finally {
478
+ try {
479
+ if (out != null) {
480
+ out.close();
481
+ }
482
+ if (br != null) {
483
+ br.close();
484
+ }
485
+ } catch (IOException ex) {
486
+ ex.printStackTrace();
487
+ }
488
+ }
489
+ if (sb.toString().isEmpty()) {
490
+ result = exception;
491
+ } else {
492
+ result = sb.toString();
493
+ }
494
+ return result;
495
+ }
496
+
497
+ public String CCPost(String path, String param) {
498
+ OutputStreamWriter out = null;
499
+ BufferedReader br = null;
500
+ StringBuffer sb = new StringBuffer();
501
+ String exception = "";
502
+ String result = "";
503
+ try {
504
+ URL url = new URL(path);
505
+ HttpURLConnection conn = null;
506
+ // 打开和URL之间的连接
507
+ conn = (HttpURLConnection) url.openConnection();
508
+ // 发送POST请求必须设置如下两行
509
+ conn.setDoOutput(true);
510
+ conn.setDoInput(true);
511
+ conn.setRequestMethod("POST"); // POST方法
512
+ conn.setConnectTimeout(15 * 1000);// 设置连接超时时间为5秒
513
+ conn.setReadTimeout(20 * 1000);// 设置读取超时时间为20秒
514
+ String tokens = "";
515
+ // 设置通用的请求属性
516
+ conn.setRequestProperty("Content-Type", "application/json");
517
+ conn.setRequestProperty("accept", "*/*");
518
+ conn.setRequestProperty("accessToken", ACCESSTOKEN);
519
+ conn.connect();
520
+ // 获取URLConnection对象对应的输出流
521
+ out = new OutputStreamWriter(conn.getOutputStream());
522
+ // 发送请求参数
523
+ BufferedWriter bw = new BufferedWriter(out);
524
+ bw.write(param);
525
+ // flush输出流的缓冲
526
+ bw.flush();
527
+ // 定义BufferedReader输入流来读取URL的响应
528
+ br = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8));
529
+ String line;
530
+ while ((line = br.readLine()) != null) {
531
+ sb.append(line);
532
+ }
533
+ } catch (Exception e) {
534
+ System.out.println("发送 POST 请求出现异常!" + e);
535
+ exception = "发送 POST 请求出现异常!" + e;
536
+ e.printStackTrace();
537
+ } finally {
538
+ try {
539
+ if (out != null) {
540
+ out.close();
541
+ }
542
+ if (br != null) {
543
+ br.close();
544
+ }
545
+ } catch (IOException ex) {
546
+ ex.printStackTrace();
547
+ }
548
+ }
549
+ if (sb.toString().isEmpty()) {
550
+ result = exception;
551
+ } else {
552
+ result = sb.toString();
553
+ }
554
+ return result;
555
+ }
556
+
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
+ public static String sendGet(String path) {
565
+ StringBuffer sb = new StringBuffer();
566
+ String exception = "";
567
+ String result = "";
568
+ try {
569
+ URL url = new URL(path);
570
+ InputStream is = url.openStream();
571
+ InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8);
572
+ BufferedReader br = new BufferedReader(isr);
573
+ String line;// 读取数据
574
+ while ((line = br.readLine()) != null) {
575
+ sb.append(line);
576
+ }
577
+ br.close();
578
+ isr.close();
579
+ is.close();
580
+ } catch (Exception e) {
581
+ e.printStackTrace();
582
+ exception = "发送 GET 请求出现异常!" + e;
583
+ }
584
+ if (sb.toString().isEmpty()) {
585
+ result = exception;
586
+ } else {
587
+ result = sb.toString();
588
+ }
589
+ return result;
590
+ }
591
+
592
+ /**
593
+ * 获取自定义列表设置
594
+ *
595
+ * @param api 接口名称,用于指定获取哪个接口的自定义设置
596
+ * @return 返回一个包含自定义设置数据的Map对象
597
+ */
598
+ public Map<String, Object> getListCustomSetting(String api) {
599
+
600
+ // 初始化数据映射对象,用于存放最终返回的数据
601
+ Map<String, Object> datMap = new HashMap<String, Object>();
602
+
603
+ // 创建参数数组,用于存放调用接口的参数
604
+ JSONArray argArray = new JSONArray();
605
+ JSONObject arryStr = new JSONObject();
606
+ arryStr.put("argType", String.class);
607
+ arryStr.put("argValue", api);
608
+ argArray.add(arryStr);
609
+
610
+ JSONObject parObj = new JSONObject();
611
+ parObj.put("className", "upsert"); // 服务名
612
+ parObj.put("methodName", "getListCustomSetting"); // 方法名
613
+ parObj.put("params", argArray); // 查询条件
614
+ try {
615
+ String relStr = CCPost(path, parObj.toString());
616
+ JSONObject.parseObject(relStr);
617
+ ObjectMapper objectMapper = new ObjectMapper();
618
+ // 将对象描述转换为字符串并添加到结果中
619
+ // datMap = objectMapper.convertValue(objectMapper, Map.class);
620
+ } catch (Exception e) {
621
+ e.printStackTrace();
622
+ logger.error("upsert报错= " + e);
623
+ }
624
+
625
+ return datMap;
626
+ }
627
+
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
+ public Map<String, Object> getListCustomSetting(String api, String key) {
639
+ Map<String, Object> datMap = new HashMap<String, Object>();
640
+ JSONArray argArray = new JSONArray();
641
+
642
+ JSONObject apiParam = new JSONObject();
643
+ apiParam.put("argType", String.class);
644
+ apiParam.put("argValue", api);
645
+ argArray.add(apiParam);
646
+
647
+ JSONObject keyParam = new JSONObject();
648
+ keyParam.put("argType", String.class);
649
+ keyParam.put("argValue", api);
650
+ argArray.add(keyParam);
651
+
652
+ JSONObject parObj = new JSONObject();
653
+ parObj.put("className", "TCCCustomSetting"); // 服务名
654
+ parObj.put("methodName", "getListCustomSetting"); // 方法名
655
+ parObj.put("params", argArray); // 查询条件
656
+
657
+ try {
658
+ String relStr = CCPost(path, parObj.toString());
659
+ JSONObject.parseObject(relStr);
660
+ ObjectMapper objectMapper = new ObjectMapper();
661
+ // 将对象描述转换为字符串并添加到结果中
662
+ // datMap = objectMapper.convertValue(objectMapper, Map.class);
663
+ } catch (Exception e) {
664
+ e.printStackTrace();
665
+ logger.error("upsert报错= " + e);
666
+ }
667
+
668
+ return datMap;
669
+ }
670
+
671
+ public Map cqueryForEs(String account, String where, String aTrue, String s) {
672
+ return null;
673
+ }
674
+
675
+ public String getPermission(String service_record, String id, String edit) {
676
+ return null;
677
+ }
678
+
679
+ public List<CCObject> cqueryWithRoleRight(String service_record, String s) {
680
+ return null;
681
+ }
682
+
683
+ public ServiceResult insert(CCObject reminder, boolean b, boolean b1, boolean b2, boolean b3) {
684
+ return null;
685
+ }
686
+
687
+ public void addCaseTeam(List<Map> caseteamList, String recordid) {
688
+ }
689
+
690
+ public ServiceResult update(CCObject serv, boolean b, boolean b1, boolean b2, boolean b3) {
691
+ return null;
692
+ }
693
+
694
+ public ServiceResult insertLt(CCObject in) throws Exception {
695
+ // TODO Auto-generated method stub
696
+ List<CCObject> datalist = new ArrayList<CCObject>();
697
+ datalist.add(in);
698
+ insert(datalist);
699
+ return null;
700
+ }
701
+
702
+ public ServiceResult updateLt(CCObject objectData) throws Exception {
703
+ // TODO Auto-generated method stub
704
+ // 不执行触发器
705
+ return null;
706
+ }
707
+
708
+ public void addMicroPost(String string, Object object, Object object2, Object object3, Object object4,
709
+ Object object5, Object object6, String string2, String emailSubject, String string3, String stkhid,
710
+ String stkhid2) {
711
+ // TODO Auto-generated method stub
712
+
713
+ }
714
+
715
+ public String sendEmail(String subject, String htmlBody, String toAddress, String relatedid, String ccaddress,
716
+ String bccaddress, String attachmentId, String s, String s1) {
717
+ return "";
718
+ }
719
+
720
+ public String uploadAttachment(Map m) {
721
+ return null;
722
+ }
723
+
724
+ public void deleteShareObjectBySql(String account, String s) {
725
+
726
+ }
727
+
728
+ public List<CCObject> cqueryByFields(String object, String exp, String fileds) {
729
+ return null;
730
+ }
731
+
732
+ public String submitForApproval(String id, String s, String s1) {
733
+ return null;
734
+ }
735
+
736
+ public String process(String processType, String tid, String touserId, String comments, String appPath) {
737
+ return null;
738
+ }
739
+
740
+ }