|
@@ -0,0 +1,149 @@
|
|
|
+package com.malk.pro;
|
|
|
+
|
|
|
+import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.util.NumberUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.malk.core.McProject;
|
|
|
+import com.malk.pro.guyuan.service.tencent.IvYdService;
|
|
|
+import com.malk.server.aliwork.YDConf;
|
|
|
+import com.malk.server.aliwork.YDParam;
|
|
|
+import com.malk.service.aliwork.YDClient;
|
|
|
+import com.malk.service.aliwork.YDService;
|
|
|
+import com.malk.service.dingtalk.DDClient;
|
|
|
+import com.malk.service.dingtalk.DDClient_Attendance;
|
|
|
+import com.malk.service.dingtalk.DDClient_Contacts;
|
|
|
+import com.malk.utils.UtilDateTime;
|
|
|
+import com.malk.utils.UtilMap;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.slf4j.MDC;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+import java.util.regex.Matcher;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/***
|
|
|
+ * 逸耀宜搭
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@SpringBootTest
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+public class YyYdTest {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private YDClient ydClient;
|
|
|
+ @Autowired
|
|
|
+ private YDService ydService;
|
|
|
+ @Autowired
|
|
|
+ private DDClient ddClient;
|
|
|
+ @Autowired
|
|
|
+ private DDClient_Attendance ddClientAttendance;
|
|
|
+ @Autowired
|
|
|
+ private DDClient_Contacts ddClientContacts;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void test() {
|
|
|
+ McProject.addYida("2001",new String[]{"APP_FKRK7Y94DPI1S9DV1605","FN7666A1ZD0STZZ75W4CKD1GD07X3PUW2FBRKT"});
|
|
|
+ MDC.put("MDC_KEY_PID","2001");
|
|
|
+
|
|
|
+ List<String> ids= FileUtil.readUtf8Lines("/home/ids.txt");
|
|
|
+ for(String id:ids){
|
|
|
+ System.out.println(id);
|
|
|
+ String[] values=id.split("###");
|
|
|
+ String uuid=values[0];
|
|
|
+ List<String> formInstanceIds =getid(values[1]);
|
|
|
+
|
|
|
+ // 宜搭批量更新
|
|
|
+ Map update = UtilMap.map("selectField_liihyrt6", "已使用");
|
|
|
+ update.put("radioField_liw7rb2q", "否"); // 提交后, 更新是否退回标识为否
|
|
|
+ // prd 9.10 更新报销单, 关联到发票:: ppExt 宜搭服务注册, 提交规则系统默认字段 [详见 YDService]
|
|
|
+ operateData2(UtilMap.map("aUuid, aCompId, aFormUuid",uuid,"associationFormField_lma7wtuj","FORM-J1A66U817Q6CURQE680BDAFCSK3U2JYI5ONJL1"), update, YDParam.builder()
|
|
|
+ .formUuid("FORM-W2A66Z910O9B3LP9C6IYUDPRVWY62DO0YHIILY")
|
|
|
+ .formInstanceIdList(formInstanceIds)
|
|
|
+ .updateFormDataJson(JSON.toJSONString(update))
|
|
|
+ .appType("APP_FKRK7Y94DPI1S9DV1605")
|
|
|
+ .systemToken("FN7666A1ZD0STZZ75W4CKD1GD07X3PUW2FBRKT")
|
|
|
+ .build(), YDConf.FORM_OPERATION.multi_update);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<String> getid(String val){
|
|
|
+ String regex = "\\[(.*?)\\]";
|
|
|
+ Pattern pattern = Pattern.compile(regex);
|
|
|
+ Matcher matcher = pattern.matcher(val);
|
|
|
+ List<String> result=new ArrayList<>();
|
|
|
+ while (matcher.find()) {
|
|
|
+ result.add(matcher.group(1)); // 获取 [] 中的内容
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Object operateData2(Map data, Map update, YDParam ydParam, YDConf.FORM_OPERATION type) {
|
|
|
+ if (data.containsKey("aUuid")) {
|
|
|
+ List<Map> process = (List)this.ydClient.queryData(YDParam.builder().formUuid(data.get("aFormUuid").toString()).searchFieldJson(JSON.toJSONString(UtilMap.map("textField_lmewsobs", new Object[]{data.get("aUuid")}))).build(), YDConf.FORM_QUERY.retrieve_search_form).getData();
|
|
|
+ update.put(data.get("aCompId"), Arrays.asList(UtilMap.map("appType, formType, instanceId, formUuid, title", new Object[]{"APP_FKRK7Y94DPI1S9DV1605", "process", ((Map)process.get(0)).get("formInstanceId"), data.get("aFormUuid"), ((Map)process.get(0)).get("title")})));
|
|
|
+ ydParam.setUpdateFormDataJson(JSON.toJSONString(update));
|
|
|
+ }
|
|
|
+ return this.ydClient.operateData(ydParam, type);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IvYdService ivYdService;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void test1() {
|
|
|
+ String compId = "selectField_liihyrt6";
|
|
|
+ String status = "已使用";
|
|
|
+
|
|
|
+ // 读取关联表单
|
|
|
+ String formUUid="";
|
|
|
+ List<String> formInstanceIds = new ArrayList<>();
|
|
|
+// if(compId.equals("selectField_lzs0bpk2")){
|
|
|
+// // 采购表单
|
|
|
+// formUUid="FORM-B5A7B20013AE4CD09AD87FAB9A3E145FS3P6";
|
|
|
+// List<Map> associationData = (List<Map>) JSON.parse(UtilMap.getString(data, "multiAssociation"));
|
|
|
+// formInstanceIds.addAll(associationData.stream().map(form -> UtilMap.getString(form, "instanceId")).collect(Collectors.toList()));
|
|
|
+// }else{
|
|
|
+// formUUid="FORM-442A54C312A64FCA9C1D19C7C1AD7314MXAJ";
|
|
|
+// List<String> associationForm = (List<String>) JSON.parse(UtilMap.getString(data, "multiAssociation"));
|
|
|
+// for (String record : associationForm) {
|
|
|
+// // 解析关联表单
|
|
|
+// List<Map> associationData = (List<Map>) JSON.parse(record);
|
|
|
+// formInstanceIds.addAll(associationData.stream().map(form -> UtilMap.getString(form, "instanceId")).collect(Collectors.toList()));
|
|
|
+// }
|
|
|
+// }
|
|
|
+ // 宜搭批量更新
|
|
|
+ Map update = UtilMap.map(compId, status);
|
|
|
+ if (compId.equals("selectField_liihyrt6")) {
|
|
|
+ update.put("radioField_liw7rb2q", "否"); // 提交后, 更新是否退回标识为否
|
|
|
+ }
|
|
|
+
|
|
|
+ // prd 9.10 更新报销单, 关联到发票:: ppExt 宜搭服务注册, 提交规则系统默认字段 [详见 YDService]
|
|
|
+// ydService.operateData3(data, update, YDParam.builder().systemToken(SYSTEM_TOKEN).appType(APP_TYPE)
|
|
|
+// .formUuid(formUUid)
|
|
|
+// .formInstanceIdList(formInstanceIds)
|
|
|
+// .updateFormDataJson(JSON.toJSONString(update))
|
|
|
+// .build(), YDConf.FORM_OPERATION.multi_update);
|
|
|
+ ivYdService.operateData(UtilMap.map("aFormUuid, aUuid","FORM-C3B4E5A1902044FF9FD030B98CiABB0ED4N7, MHC66LD1DYNWSVXWD0ZYF7AWSNGF33L8TJECMP6"), update, YDParam.builder().systemToken(SYSTEM_TOKEN).appType(APP_TYPE)
|
|
|
+ .formUuid(formUUid)
|
|
|
+ .formInstanceIdList(formInstanceIds)
|
|
|
+ .updateFormDataJson(JSON.toJSONString(update))
|
|
|
+ .build(), YDConf.FORM_OPERATION.multi_update);
|
|
|
+ try {
|
|
|
+ Thread.sleep(30000);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private final static String APP_TYPE="APP_Y5KGBSIKJGG6ZQBTNKSZ";
|
|
|
+ private final static String SYSTEM_TOKEN="GFA66U91QQDMO11Y7N7YC7MA6U0M236VMM2YLBO11";
|
|
|
+
|
|
|
+
|
|
|
+}
|