|
@@ -4,6 +4,8 @@ package com.malk.ruisi.controller;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+
|
|
|
+
|
|
|
import com.malk.ruisi.service.QysService;
|
|
|
import com.malk.ruisi.service.RsQysService;
|
|
|
import com.malk.ruisi.service.impl.dingshiqiImpl;
|
|
@@ -12,13 +14,16 @@ import com.malk.server.aliwork.YDParam;
|
|
|
import com.malk.server.common.McException;
|
|
|
import com.malk.server.common.McR;
|
|
|
import com.malk.server.dingtalk.DDConf;
|
|
|
+import com.malk.server.dingtalk.DDR_New;
|
|
|
import com.malk.service.aliwork.YDClient;
|
|
|
import com.malk.service.aliwork.YDService;
|
|
|
import com.malk.service.dingtalk.DDClient;
|
|
|
+import com.malk.service.dingtalk.DDClient_Contacts;
|
|
|
import com.malk.utils.UtilHttp;
|
|
|
import com.malk.utils.UtilMap;
|
|
|
+import com.malk.utils.UtilServlet;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.xmlbeans.impl.jam.mutable.MClass;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.io.Resource;
|
|
|
import org.springframework.core.io.UrlResource;
|
|
@@ -27,6 +32,7 @@ import org.springframework.http.MediaType;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
import java.io.IOException;
|
|
|
import java.net.MalformedURLException;
|
|
|
import java.nio.file.Path;
|
|
@@ -86,61 +92,138 @@ public class QysHuiDaoController {
|
|
|
}
|
|
|
@Autowired
|
|
|
private YDService ydService;
|
|
|
+
|
|
|
+ @PostMapping("/success")
|
|
|
+ McR rsuccess(HttpServletRequest request){
|
|
|
+ Map<String,?> data = UtilServlet.getParamMap(request);
|
|
|
+ log.info("请假成功:{}",JSON.toJSONString(data));
|
|
|
+ return McR.success();
|
|
|
+ }
|
|
|
+ @Autowired
|
|
|
+ private DDClient_Contacts ddClient_contacts;
|
|
|
+ //获取用户邮箱信息
|
|
|
+ @GetMapping("/test22")
|
|
|
+ public McR test22() throws Exception {
|
|
|
+ String userId = "722";
|
|
|
+
|
|
|
+ String org_email = "";
|
|
|
+ if (StringUtils.isNotBlank(userId)) {
|
|
|
+// String[] userIds = userId.split(",");
|
|
|
+// String yzsyzid2 = userIds[0];
|
|
|
+ Map userInfoByMobile1 = ddClient_contacts.getUserInfoById(ddClient.getAccessToken(), userId);
|
|
|
+ org_email = String.valueOf(userInfoByMobile1.get("org_email"));
|
|
|
+ log.info("userInfo:{},org_email:{}", userInfoByMobile1,org_email);
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstId("aa6db5e6-e81b-4fcd-937b-ad78d8ce75cd")
|
|
|
+ .updateFormDataJson(JSON.toJSONString(UtilMap.map("textField_m2sgwol5",org_email)))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+ }
|
|
|
+ return McR.success(userId);
|
|
|
+ }
|
|
|
//更新表单字段
|
|
|
@GetMapping("/test20")
|
|
|
McR test12() {
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
- .formInstanceId("9f32c151-956d-4f4a-a175-c31cbcc8c905")
|
|
|
- .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("departmentSelectField_lys0k6qb",Arrays.asList("154981944"))))
|
|
|
+ .formInstanceId("a8b1bfa9-ab69-47f0-aa09-083483e177bc")
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("associationFormField_lvz3j6lr",Arrays.asList(getAss("物理用印公司用印场景","FINST-5V766V61BVZKFD1C68KB14U69RMR3TXGWM4WL1XN1")))))
|
|
|
+// .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("textField_ltwe0wyb, textField_lvz3j6ls","物理用印公司用印场景, 2731787510660432675")))
|
|
|
.useLatestVersion(true)
|
|
|
.build(), YDConf.FORM_OPERATION.update);
|
|
|
return McR.success();
|
|
|
}
|
|
|
- @GetMapping("/test21")
|
|
|
- McR test21() {
|
|
|
- String formInstanceId = "644298b7-6503-4576-a9f5-bb520bbe752d";//请假表单实例ID
|
|
|
- String userId = "1006793";
|
|
|
+ //更新表单字段
|
|
|
+ @PostMapping("/test30")
|
|
|
+ McR test13(@RequestBody Map data) {
|
|
|
+ String ins = String.valueOf(data.get("ins"));
|
|
|
+
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+
|
|
|
+ .formInstanceId(ins)
|
|
|
+ // .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("associationFormField_lu0u6npd",Arrays.asList(getAss("上海领语堂培训学校有限公司 公章","FINST-9Z766DC18KCP57M49WZHHDDAD8ST236FYJ42M0C")))))
|
|
|
+// .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("textField_lvz1kozg, textField_lvm5xmqe, textField_lvz1kozf","多方电子用印(企业)(对方先签), 2741605538270839198, 上海领语堂培训学校有限公司")))
|
|
|
+// .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("departmentSelectField_lys0k6qb",Arrays.asList("527436269"))))
|
|
|
+ .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("textField_lvzz59hn","2911560302743331144")))
|
|
|
+ .useLatestVersion(true)
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+ return McR.success();
|
|
|
+ }
|
|
|
+ private Object getAss(String title,String id){
|
|
|
+ return UtilMap.map("appType, formUuid, formType, instanceId, title, subTitle","APP_VCTRP6227CC8368NDOID","FORM-417576F4EE9F4AA1B2395BCD93B7A08C8ASN","receipt",id,title,"");
|
|
|
+ }
|
|
|
+ @PostMapping("/test21")
|
|
|
+ McR test21(@RequestBody Map data) {
|
|
|
+// String formInstanceId = "3d1368b1-1d8a-49c7-8cf1-6b3d555105c6";//请假表单实例ID
|
|
|
+// String userId = "1004909";
|
|
|
+ String formInstanceId = String.valueOf(data.get("formInstanceId"));
|
|
|
+ String userId = String.valueOf(data.get("userId"));
|
|
|
+ Map formData = (Map) ydClient.queryData(YDParam.builder().formInstId(formInstanceId)
|
|
|
+ .appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
|
|
|
+ .build(), YDConf.FORM_QUERY.retrieve_id).getFormData();
|
|
|
+ List employeeField_lts1mg30_id = (List) formData.get("employeeField_lts1mg30_id");
|
|
|
+ List departmentSelectField_lts1mg2z_id = (List) formData.get("departmentSelectField_lts1mg2z_id");
|
|
|
+ List departmentSelectField_lys0k6qb_id = (List) formData.get("departmentSelectField_lys0k6qb_id");
|
|
|
+ //
|
|
|
+ System.out.println("=="+employeeField_lts1mg30_id);
|
|
|
+ formData.put("employeeField_lts1mg30", employeeField_lts1mg30_id);
|
|
|
+ formData.put("departmentSelectField_lts1mg2z", departmentSelectField_lts1mg2z_id);
|
|
|
+ formData.put("departmentSelectField_lys0k6qb", departmentSelectField_lys0k6qb_id);
|
|
|
+
|
|
|
+ System.out.println(formData);
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
|
|
|
+ .formUuid("FORM-A02F7EA3AD6548E59B8E1692AD729C77C5LD")
|
|
|
+ .userId(userId)
|
|
|
+ .formDataJson(JSON.toJSONString(formData))
|
|
|
+ .build(), YDConf.FORM_OPERATION.start).toString();////
|
|
|
+ return McR.success(formData);
|
|
|
+ }
|
|
|
+ @PostMapping("/test22")
|
|
|
+ McR test22(@RequestBody Map data ) {
|
|
|
+// String formInstanceId = "d738e145-e0ca-4b1e-87c8-d278330041b7";//离职单
|
|
|
+// String userId = "1007210";
|
|
|
+ String formInstanceId = String.valueOf(data.get("formInstanceId"));
|
|
|
+ String userId = String.valueOf(data.get("userId"));
|
|
|
Map formData = (Map) ydClient.queryData(YDParam.builder().formInstId(formInstanceId)
|
|
|
.appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
|
|
|
.build(), YDConf.FORM_QUERY.retrieve_id).getFormData();
|
|
|
- List employeeField_lts1mg30_id = (List) formData.get("employeeField_lts1mg30_id");
|
|
|
- List departmentSelectField_lts1mg2z_id = (List) formData.get("departmentSelectField_lts1mg2z_id");
|
|
|
-// List departmentSelectField_lys0k6qb_id = (List) formData.get("departmentSelectField_lys0k6qb_id");
|
|
|
-//
|
|
|
- System.out.println("=="+employeeField_lts1mg30_id);
|
|
|
- formData.put("employeeField_lts1mg30", employeeField_lts1mg30_id);
|
|
|
- formData.put("departmentSelectField_lts1mg2z", departmentSelectField_lts1mg2z_id);
|
|
|
-// formData.put("departmentSelectField_lys0k6qb", departmentSelectField_lys0k6qb_id);
|
|
|
-
|
|
|
+ List employeeField_lts8k71n_id = (List) formData.get("employeeField_lts8k71n_id");
|
|
|
+ List departmentSelectField_lts8k71m_id = (List) formData.get("departmentSelectField_lts8k71m_id");
|
|
|
+ List departmentSelectField_lx9uj3ds_id = (List) formData.get("departmentSelectField_lx9uj3ds_id");
|
|
|
+ List employeeField_lwt3bde4_id = (List) formData.get("employeeField_lwt3bde4_id");
|
|
|
+// System.out.println("=="+employeeField_lts1mg30_id);
|
|
|
+ formData.put("employeeField_lts8k71n", employeeField_lts8k71n_id);
|
|
|
+ formData.put("departmentSelectField_lts8k71m", departmentSelectField_lts8k71m_id);
|
|
|
+ formData.put("departmentSelectField_lx9uj3ds", departmentSelectField_lx9uj3ds_id);
|
|
|
+ formData.put("employeeField_lwt3bde4", employeeField_lwt3bde4_id);
|
|
|
System.out.println(formData);
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
.appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
|
|
|
- .formUuid("FORM-A02F7EA3AD6548E59B8E1692AD729C77C5LD")
|
|
|
+ .formUuid("FORM-2C6A3F5B7A194F2390A5BA9677055295XVHL")
|
|
|
.userId(userId)
|
|
|
.formDataJson(JSON.toJSONString(formData))
|
|
|
.build(), YDConf.FORM_OPERATION.start).toString();////
|
|
|
return McR.success(formData);
|
|
|
}
|
|
|
- @GetMapping("/test22")
|
|
|
- McR test22() {
|
|
|
- String formInstanceId = "d738e145-e0ca-4b1e-87c8-d278330041b7";
|
|
|
- String userId = "1007210";
|
|
|
+ @GetMapping("/test25")
|
|
|
+ McR test25() {
|
|
|
+ String formInstanceId = "92c69cfe-c8f8-476b-bd34-58aefc19abcb";//it07
|
|
|
+ String userId = "1003682";
|
|
|
Map formData = (Map) ydClient.queryData(YDParam.builder().formInstId(formInstanceId)
|
|
|
.appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
|
|
|
.build(), YDConf.FORM_QUERY.retrieve_id).getFormData();
|
|
|
- List employeeField_lts8k71n_id = (List) formData.get("employeeField_lts8k71n_id");
|
|
|
- List departmentSelectField_lts8k71m_id = (List) formData.get("departmentSelectField_lts8k71m_id");
|
|
|
- List departmentSelectField_lx9uj3ds_id = (List) formData.get("departmentSelectField_lx9uj3ds_id");
|
|
|
+ List employeeField_lts8k71n_id = (List) formData.get("employeeField_lu7zrcj3_id");
|
|
|
+ List departmentSelectField_lts8k71m_id = (List) formData.get("departmentSelectField_lu7zrcj4_id");
|
|
|
+ List departmentSelectField_lx9uj3ds_id = (List) formData.get("departmentSelectField_lyr15lez_id");
|
|
|
// List employeeField_lwt3bde4_id = (List) formData.get("employeeField_lwt3bde4_id");
|
|
|
// System.out.println("=="+employeeField_lts1mg30_id);
|
|
|
- formData.put("employeeField_lts8k71n", employeeField_lts8k71n_id);
|
|
|
- formData.put("departmentSelectField_lts8k71m", departmentSelectField_lts8k71m_id);
|
|
|
- formData.put("departmentSelectField_lx9uj3ds", departmentSelectField_lx9uj3ds_id);
|
|
|
+ formData.put("employeeField_lu7zrcj3", employeeField_lts8k71n_id);
|
|
|
+ formData.put("departmentSelectField_lu7zrcj4", departmentSelectField_lts8k71m_id);
|
|
|
+ formData.put("departmentSelectField_lyr15lez", departmentSelectField_lx9uj3ds_id);
|
|
|
// formData.put("employeeField_lwt3bde4", employeeField_lwt3bde4_id);
|
|
|
System.out.println(formData);
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
.appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
|
|
|
- .formUuid("FORM-2C6A3F5B7A194F2390A5BA9677055295XVHL")
|
|
|
+ .formUuid("FORM-0AD770FAD54A47CA938A9D338C6FBB1BZ7AH")
|
|
|
.userId(userId)
|
|
|
.formDataJson(JSON.toJSONString(formData))
|
|
|
.build(), YDConf.FORM_OPERATION.start).toString();////
|
|
@@ -171,17 +254,33 @@ public class QysHuiDaoController {
|
|
|
.build(), YDConf.FORM_OPERATION.start).toString();////
|
|
|
return McR.success(formData);
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/test61")
|
|
|
+ public McR test15() throws Exception {
|
|
|
+ Map formData = ydClient.queryData(YDParam.builder().formInstId("b9a7515d-70f3-4a38-b81a-9e126f0c6bb4")
|
|
|
+ .appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
|
|
|
+ .userId(ddConf.getOperator()).build(), YDConf.FORM_QUERY.retrieve_id).getFormData();
|
|
|
+ JSONArray tableField_m29vcuas = (JSONArray) formData.get("tableField_m29vcuas");
|
|
|
+ for (int i = 0; i < tableField_m29vcuas.size(); i++) {
|
|
|
+ JSONObject o = (JSONObject) tableField_m29vcuas.get(i);
|
|
|
+ System.out.println(o.get("employeeField_m2cy3eg0_id"));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return McR.success(formData);
|
|
|
+ }
|
|
|
//刷新页面为最新版本
|
|
|
@GetMapping("/test6")
|
|
|
public McR test6() throws Exception {
|
|
|
List<Map> datalist = ydService.queryFormData_all(YDParam.builder()
|
|
|
- .formUuid("FORM-2C6A3F5B7A194F2390A5BA9677055295XVHL")
|
|
|
+ .formUuid("FORM-2C10C625AF2D456F93852DFEAEBF9C349IQA")
|
|
|
.build()
|
|
|
);
|
|
|
for (Map map : datalist) {
|
|
|
ydClient.operateData(YDParam.builder()
|
|
|
.useLatestVersion(true)
|
|
|
.formInstanceId(UtilMap.getString(map, "formInstanceId"))
|
|
|
+// .formInstanceId("a5b23b72-c450-4ffe-83b0-a5a59a3cbaa4")
|
|
|
.updateFormDataJson(JSONObject.toJSONString(new HashMap<>()))
|
|
|
.build(), YDConf.FORM_OPERATION.update);
|
|
|
}
|
|
@@ -371,6 +470,63 @@ public class QysHuiDaoController {
|
|
|
// }
|
|
|
return "success";
|
|
|
}
|
|
|
+ @GetMapping("/test32")
|
|
|
+ public McR test32() throws Exception {
|
|
|
+// ArrayList<Object> objects = new ArrayList<>();
|
|
|
+// objects.add("722");
|
|
|
+// objects.add("1006660");
|
|
|
+// System.out.println(objects);
|
|
|
+// for (Object obj : objects) {
|
|
|
+// System.out.println(obj);
|
|
|
+// DDR_New ddrNew = (DDR_New) UtilHttp.doPost("https://oapi.dingtalk.com/topapi/v2/user/get", null, ddClient.initTokenParams(), UtilMap.map("userid", obj), DDR_New.class);
|
|
|
+// System.out.println("==="+ddrNew);
|
|
|
+// Object result = ddrNew.getResult();
|
|
|
+// if (result != null) {
|
|
|
+// JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(result));
|
|
|
+// String mobile = jsonObject.getString("orgEmail");
|
|
|
+// System.out.println("mobile====="+mobile);
|
|
|
+// }
|
|
|
+// System.out.println("11"+result);
|
|
|
+//
|
|
|
+// }
|
|
|
+ Map userInfoById = ddClient_contacts.getUserInfoById(ddClient.getAccessToken(), "1006660");
|
|
|
+ String org_email = String.valueOf(userInfoById.get("org_email"));
|
|
|
+ return McR.success(org_email);
|
|
|
+ }
|
|
|
+ @GetMapping("/test33")
|
|
|
+ public McR test33() throws Exception {
|
|
|
+ List<Map> dataList = ydService.queryFormData_all(YDParam.builder()
|
|
|
+ .formUuid("FORM-11B80FC621CA4DB9A35364CFBFF7287538KR")
|
|
|
+ .build());
|
|
|
+ dataList.forEach(data -> {
|
|
|
+ if ("未启用".equals(UtilMap.getString(data, "radiofield_MMa26Yu4"))) {
|
|
|
+ String userId = UtilMap.getString(data, "textField_lztc6k3k");
|
|
|
+ String message = "";
|
|
|
+ try {
|
|
|
+ this.delectExclusiveUser(userId);
|
|
|
+ } catch (McException e) {
|
|
|
+ message = e.getMessage();
|
|
|
+ log.error(e.getMessage(), e);
|
|
|
+ }
|
|
|
+// ydClient.operateData(YDParam.builder()
|
|
|
+// .formInstanceId(UtilMap.getString(data, "instanceId"))
|
|
|
+// .useLatestVersion(true)
|
|
|
+// .updateFormDataJson(JSON.toJSONString(UtilMap.map("radioField_m0hlup9w, employeeField_m0hlup9v, textareaField_m0hs4k90", "是", Arrays.asList(userId), message)))
|
|
|
+// .build(), YDConf.FORM_OPERATION.update);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return McR.success(dataList);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void delectExclusiveUser(String userId) throws McException {
|
|
|
+ Map param2 = new HashMap();
|
|
|
+ param2.put("access_token", dingshiqiImpl.getAccessToken_PJSS());
|
|
|
+ Map body = new HashMap();
|
|
|
+ body.put("userid", userId);
|
|
|
+ String s = UtilHttp.doGet("https://oapi.dingtalk.com/topapi/v2/user/delete", param2, (Map<String, Object>) body);
|
|
|
+ JSONObject obj = JSONObject.parseObject(s);
|
|
|
+ JSONArray arr = obj.getJSONArray("result");
|
|
|
+ }
|
|
|
@GetMapping("/test2")
|
|
|
public String test2() throws Exception {
|
|
|
dingshiqiImpl dingshiqi = new dingshiqiImpl();
|
|
@@ -383,34 +539,37 @@ return "success";
|
|
|
// .build(), YDConf.FORM_QUERY.retrieve_list).getData();
|
|
|
// Map map = list1.get(0);
|
|
|
// String instanceId = (String) map.get("formInstanceId");
|
|
|
- String instanceId = "68b97e35-4707-4cd5-bff8-c5118e2db4ce";
|
|
|
+ String instanceId = "b3f6533c-d247-4355-82e7-4c6868c7b042";
|
|
|
Map param2 = new HashMap();
|
|
|
param2.put("x-acs-dingtalk-access-token", dingshiqi.getAccessToken_PJSS());
|
|
|
Map body3 = new HashMap();
|
|
|
body3.put("appType","APP_VCTRP6227CC8368NDOID");
|
|
|
body3.put("systemToken","5H9662C1X8XJLFFCE841M5VBEBQ73DM5IBPULPI3");
|
|
|
body3.put("processInstanceId", instanceId);
|
|
|
- body3.put("userId","15099924886");
|
|
|
+ body3.put("userId","1006781");
|
|
|
boolean flag=true;
|
|
|
do {
|
|
|
String s = UtilHttp.doGet("https://api.dingtalk.com/v1.0/yida/processes/operationRecords", param2, (Map<String, Object>) body3);
|
|
|
JSONObject obj=JSONObject.parseObject(s);
|
|
|
JSONArray arr = obj.getJSONArray("result");
|
|
|
- for (int i = 0; i < arr.size(); i++) {
|
|
|
- JSONObject json = arr.getJSONObject(i);
|
|
|
- flag=false;
|
|
|
-// if(json.getString("operatorUserId").equals("13810479803")&&json.getString("type").equals("TODO")){
|
|
|
- try {
|
|
|
- taskExecute(instanceId,json.getString("taskId"));
|
|
|
- }catch (McException e){
|
|
|
- log.error("taskExecute error:{}",e.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- flag=true;
|
|
|
- break;
|
|
|
-
|
|
|
-// }
|
|
|
- }
|
|
|
+ System.out.println(arr);
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+// for (int i = 0; i < arr.size(); i++) {
|
|
|
+// JSONObject json = arr.getJSONObject(i);
|
|
|
+// flag=false;
|
|
|
+//// if(json.getString("operatorUserId").equals("13810479803")&&json.getString("type").equals("TODO")){
|
|
|
+// try {
|
|
|
+// taskExecute(instanceId,json.getString("taskId"));
|
|
|
+// }catch (McException e){
|
|
|
+// log.error("taskExecute error:{}",e.getMessage());
|
|
|
+// }
|
|
|
+//
|
|
|
+// flag=true;
|
|
|
+// break;
|
|
|
+//
|
|
|
+//// }
|
|
|
+// }
|
|
|
}while (flag);
|
|
|
return "success";
|
|
|
}
|