|
@@ -2,24 +2,26 @@ package com.malk.mc.controller;
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.malk.core.McProject;
|
|
|
import com.malk.server.aliwork.YDConf;
|
|
|
import com.malk.server.aliwork.YDParam;
|
|
|
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;
|
|
|
import com.malk.utils.PublicUtil;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.slf4j.MDC;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.Arrays;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/***
|
|
|
* 宜搭服务
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@RestController
|
|
|
@RequestMapping("/yd/")
|
|
|
public class McYdController {
|
|
@@ -61,4 +63,44 @@ public class McYdController {
|
|
|
return McR.success();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据筛选条件获取表单数据
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("getFromData")
|
|
|
+ public Map getFromData(String formUuid,String fieldCode,String fileValue){
|
|
|
+ log.info("formUuid:{},fieldCode:{},fileValue:{}",formUuid,fieldCode,fileValue);
|
|
|
+ MDC.put("MDC_KEY_PID","1004");
|
|
|
+// McProject.addYida("1004",new String[] {"APP_YMOUJB8W36ZVCJ9BUE77","YE966DA1CKMCAWSRAM78Y5K6NESA27LKXC9KL6C2"});
|
|
|
+
|
|
|
+ fileValue = Objects.nonNull(fileValue) ? fileValue : "";
|
|
|
+
|
|
|
+ List<Map> ydFormDataList = getYdFormDataList(formUuid, JSONObject.toJSONString(UtilMap.map(fieldCode, fileValue)), YDConf.FORM_QUERY.retrieve_list);
|
|
|
+
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
+
|
|
|
+ resultMap.put("data", ydFormDataList);
|
|
|
+
|
|
|
+ return resultMap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private List<Map> getYdFormDataList(String formUuid, String searchCondition, YDConf.FORM_QUERY formQuery) {
|
|
|
+ List<Map> list = new ArrayList<>();
|
|
|
+ DDR_New ddrNew;
|
|
|
+ int pageNumber = 1;
|
|
|
+ int pageSize = 100;
|
|
|
+ do {
|
|
|
+ ddrNew = ydClient.queryData(YDParam.builder().formUuid(formUuid)
|
|
|
+ .searchCondition(searchCondition)
|
|
|
+ .pageNumber(pageNumber)
|
|
|
+ .pageSize(pageSize).build(), formQuery);
|
|
|
+
|
|
|
+ list.addAll((List<Map>) ddrNew.getData());
|
|
|
+ pageNumber++;
|
|
|
+ }while (ddrNew.getTotalCount() > ddrNew.getPageNumber() * pageSize);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
}
|