|
@@ -1,13 +1,11 @@
|
|
|
package com.malk.ruisi.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.malk.ruisi.service.RSService;
|
|
|
import com.malk.server.aliwork.YDConf;
|
|
|
import com.malk.server.aliwork.YDParam;
|
|
|
import com.malk.server.common.McException;
|
|
|
-import com.malk.server.common.McR;
|
|
|
import com.malk.server.dingtalk.DDR_New;
|
|
|
import com.malk.service.aliwork.YDClient;
|
|
|
import com.malk.service.aliwork.YDService;
|
|
@@ -17,22 +15,18 @@ import com.malk.service.dingtalk.DDClient_Workflow;
|
|
|
import com.malk.utils.UtilDateTime;
|
|
|
import com.malk.utils.UtilHttp;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
-import com.malk.utils.UtilServlet;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import okhttp3.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
-import java.io.IOException;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalTime;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
+
|
|
|
@EnableScheduling
|
|
|
@Service
|
|
|
@Slf4j
|
|
@@ -41,13 +35,13 @@ public class RSImplService implements RSService {
|
|
|
@Autowired
|
|
|
private YDService ydService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DDClient_Workflow ddsClient_workflow;
|
|
|
@Autowired
|
|
|
private YDClient ydClient;
|
|
|
|
|
|
@Autowired
|
|
|
private DDClient_Contacts ddClient_contacts;
|
|
|
- @Autowired
|
|
|
- private DDClient_Workflow ddClientWorkflow;
|
|
|
|
|
|
@Autowired
|
|
|
private DDClient ddClient;
|
|
@@ -150,6 +144,8 @@ public class RSImplService implements RSService {
|
|
|
, YDConf.FORM_QUERY.retrieve_id);
|
|
|
Map data1 = ddrNew1.getFormData();
|
|
|
List<Map> list = new ArrayList<>();
|
|
|
+ String sc = "textField_lyi27i6m";
|
|
|
+ String fd = "textField_lyi27i6m, employeeField_m1jgzubs, textField_lyi27i6l";
|
|
|
if (data1.get("tableField_m2cx8zh5") != null){
|
|
|
list = (List<Map>) data1.get("tableField_m2cx8zh5");
|
|
|
}
|
|
@@ -163,12 +159,10 @@ public class RSImplService implements RSService {
|
|
|
Map map = (Map) list.get(i);
|
|
|
// List<Map> user = (List<Map>) ;
|
|
|
sss2.put("employeeField_m2cx8zh6",map.get("employeeField_m2cx8zh6_id"));
|
|
|
-
|
|
|
sss2.put("textareaField_m2cx8zh7",map.get("textareaField_m2cx8zh7"));
|
|
|
maps_YD.add(sss2);
|
|
|
}
|
|
|
maps_YD.add(sss);//新增数据
|
|
|
-
|
|
|
Map map = new HashMap();
|
|
|
map.put(UtilMap.getString(data, "compId"),UtilMap.getList(data, "userIds"));
|
|
|
map.put("tableField_m2cx8zh5",maps_YD);
|
|
@@ -179,15 +173,49 @@ public class RSImplService implements RSService {
|
|
|
.build(), YDConf.FORM_OPERATION.update);
|
|
|
String userIds = String.valueOf(data.get("atUserId"));
|
|
|
String[] split = userIds.split(",");
|
|
|
+
|
|
|
+ List<Map> list1 = (List<Map>) ydClient.queryData(YDParam.builder().formUuid("FORM-E9A189E6B39E4C12A9F764571DA6FD35GGKX").searchCondition(
|
|
|
+ JSONObject.toJSONString(UtilMap.map("textField_lyi27i6m", processInstanceId))
|
|
|
+ ).build(), YDConf.FORM_QUERY.retrieve_list).getData();
|
|
|
+ if(list1.size()>0){
|
|
|
+ Map glbd = list1.get(0);
|
|
|
+ Map title = (Map) glbd.get("formData");
|
|
|
+ String title1 = String.valueOf(title.get("textField_lyi27i6l"));
|
|
|
+ DDR_New ddrNew2 = ydClient.queryData(YDParam.builder()
|
|
|
+ .formUuid("FORM-72D715DB1B78438BAAC49EB81B7D8475H748")
|
|
|
+ .searchFieldJson(JSONObject.toJSONString(UtilMap.map(sc, processInstanceId)))
|
|
|
+ .build(), YDConf.FORM_QUERY.retrieve_list);
|
|
|
+ List<Map> data5 = (List<Map>) ddrNew2.getData();
|
|
|
+ List<String> emps1 = Arrays.asList(split);
|
|
|
+ Set<String> set2 = new HashSet<>(emps1);
|
|
|
+ Map mapForm;
|
|
|
+ if(data5.size()>0){
|
|
|
+ mapForm = (Map) data5.get(0).get("formData");
|
|
|
+ List<String> emps = (List<String>) mapForm.get("employeeField_m1jgzubs_id");
|
|
|
+ // 将列表转换为Set以去除重复项
|
|
|
+ Set<String> set1 = new HashSet<>(emps);
|
|
|
+ // 合并两个Set
|
|
|
+ set2.addAll(set1);
|
|
|
+ }
|
|
|
+ mapForm = UtilMap.map(fd, processInstanceId, set2, title1);
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formUuid("FORM-72D715DB1B78438BAAC49EB81B7D8475H748")
|
|
|
+ .searchCondition(JSONObject.toJSONString(UtilMap.map(sc, processInstanceId)))
|
|
|
+ .formDataJson(JSONObject.toJSONString(mapForm))
|
|
|
+ .build(), YDConf.FORM_OPERATION.upsert).toString();
|
|
|
+ }
|
|
|
ArrayList<String> names = new ArrayList<>();
|
|
|
for(Object auserId : split){
|
|
|
+// String zxuserid = "";
|
|
|
DDR_New ddrNew = (DDR_New) UtilHttp.doPost("https://oapi.dingtalk.com/topapi/v2/user/get", null, ddClient.initTokenParams(), UtilMap.map("userid", auserId), DDR_New.class);
|
|
|
Object result = ddrNew.getResult();
|
|
|
if (result != null) {
|
|
|
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(result));
|
|
|
String name = jsonObject.getString("name");
|
|
|
+// zxuserid = String.valueOf(auserId);
|
|
|
names.add(name);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
data.put("content", names.stream().collect(Collectors.joining(",")) + ":" +UtilMap.getString(data, "content"));
|
|
@@ -199,11 +227,11 @@ public class RSImplService implements RSService {
|
|
|
.build();
|
|
|
if (UtilMap.getBoolean(data, "isNotice")) {
|
|
|
ydParam.setAtUserId(UtilMap.getString(data, "atUserId"));
|
|
|
-
|
|
|
- ddClientWorkflow.createTBTask(ddClient.getAccessToken(),"","标题","描述",
|
|
|
- UtilDateTime.getLocalDateTimeTimeStamp(LocalDate.now().plusDays(7).atTime(LocalTime.MAX)), Arrays.asList(""),Arrays.asList("")
|
|
|
- ,UtilMap.map("appUrl, pcUrl","www","www"),false,30,UtilMap.map("dingNotify","1"));
|
|
|
+// ddsClient_workflow.createTBTask(ddClient.getAccessToken(),UtilMap.getString(data, "atUserId"),"标题",UtilMap.getString(data, "content"),
|
|
|
+// UtilDateTime.getLocalDateTimeTimeStamp(LocalDate.now().plusDays(7).atTime(LocalTime.MAX)), Arrays.asList(""),Arrays.asList("")
|
|
|
+// ,UtilMap.map("appUrl, pcUrl","www","www"),false,30,UtilMap.map("dingNotify","1"));
|
|
|
}
|
|
|
+
|
|
|
ydClient.operateData(ydParam, YDConf.FORM_OPERATION.remarks);
|
|
|
}
|
|
|
|