|
@@ -1,85 +1,85 @@
|
|
|
-//package com.malk.rongzhi.controller;
|
|
|
-//
|
|
|
-//import cn.hutool.core.util.ObjectUtil;
|
|
|
-//import com.alibaba.fastjson.JSON;
|
|
|
-//import com.malk.Util.UtilMap;
|
|
|
-//import com.malk.Util.UtilServlet;
|
|
|
-//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.service.aliwork.YDClient;
|
|
|
-//import com.malk.service.dingtalk.DDClient;
|
|
|
-//import com.malk.service.dingtalk.DDClient_Contacts;
|
|
|
-//import lombok.extern.slf4j.Slf4j;
|
|
|
-//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-//import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-//import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-//import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-//import org.springframework.web.bind.annotation.RestController;
|
|
|
-//
|
|
|
-//import javax.servlet.http.HttpServletRequest;
|
|
|
-//import java.util.ArrayList;
|
|
|
-//import java.util.List;
|
|
|
-//import java.util.Map;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * 错误抛出与拦截详见CatchException
|
|
|
-// */
|
|
|
-//@Slf4j
|
|
|
-//@RestController
|
|
|
-//@RequestMapping("/shijianguan")
|
|
|
-//public class ShiJianGuanController {
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private DDClient_Contacts ddClient_contacts;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private DDClient ddClient;
|
|
|
-//
|
|
|
-// @Autowired
|
|
|
-// private YDClient ydClient;
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 创建人员
|
|
|
-// */
|
|
|
-// @PostMapping("user")
|
|
|
-// McR createUser(HttpServletRequest request) {
|
|
|
-// Map<String, Object> param = UtilServlet.getParamMap(request);
|
|
|
-// log.info("创建用户, {}", param);
|
|
|
-// McException.assertParamException_Null(param, "name", "mobile", "deptId");
|
|
|
-// List<String> deptIds = new ArrayList<>();
|
|
|
-// if (ObjectUtil.isNotNull(param.get("proDeptIds"))) {
|
|
|
-// deptIds.addAll((List<String>) JSON.parse(String.valueOf(param.get("proDeptIds"))));
|
|
|
-// }
|
|
|
-// deptIds.add(String.valueOf(param.get("deptId")));
|
|
|
-// ddClient_contacts.createUser(ddClient.getAccessToken(), String.valueOf(param.get("name")), String.valueOf(param.get("mobile")), deptIds, UtilMap.map("title", param.get("title")));
|
|
|
-// return McR.success();
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 创建部门
|
|
|
-// */
|
|
|
-// @PostMapping("department")
|
|
|
-// McR createDepartment(HttpServletRequest request) {
|
|
|
-// Map<String, Object> param = UtilServlet.getParamMap(request);
|
|
|
-// log.info("创建部门, {}", param);
|
|
|
-// McException.assertParamException_Null(param, "name", "parentId", "formInstId", "compId_dept");
|
|
|
-// Map extInfo = UtilMap.map("hide_dept, create_dept_group, auto_approve_apply", true, true, true);
|
|
|
-// Map rsp = ddClient_contacts.createDepartment(ddClient.getAccessToken(), String.valueOf(param.get("name")), Long.valueOf(String.valueOf(param.get("parentId"))), extInfo);
|
|
|
-// ydClient.operateData(YDParam.builder()
|
|
|
-// .formInstanceId(String.valueOf(param.get("formInstId")))
|
|
|
-// .updateFormDataJson(JSON.toJSONString(UtilMap.map(String.valueOf(param.get("compId_dept")), rsp.get("dept_id"))))
|
|
|
-// .build(), YDConf.FORM_OPERATION.update);
|
|
|
-// return McR.success();
|
|
|
-// }
|
|
|
-//
|
|
|
-// @GetMapping("test")
|
|
|
-// McR test() {
|
|
|
-// ydClient.operateData(YDParam.builder()
|
|
|
-// .formInstanceId("FINST-96766PB1LPS9DBVSBKN988PIAFGM3HJBBACGLJO8")
|
|
|
-// .updateFormDataJson(JSON.toJSONString(UtilMap.map("title", "{\"en_US\":\"gao^sheng^hao(高圣昊)发起的UnNamed Process Form\",\"pureEn_US\":\"gao^sheng^hao(高圣昊)发起的UnNamed Process Form\",\"type\":\"i18n\",\"zh_CN\":\"高圣昊发起的付款申请单\"}")))
|
|
|
-// .build(), YDConf.FORM_OPERATION.update);
|
|
|
-// return McR.success();
|
|
|
-// }
|
|
|
-//}
|
|
|
+package com.malk.rongzhi.controller;
|
|
|
+
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.malk.Util.UtilMap;
|
|
|
+import com.malk.Util.UtilServlet;
|
|
|
+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.service.aliwork.YDClient;
|
|
|
+import com.malk.service.dingtalk.DDClient;
|
|
|
+import com.malk.service.dingtalk.DDClient_Contacts;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 错误抛出与拦截详见CatchException
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/shijianguan")
|
|
|
+public class ShiJianGuanController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DDClient_Contacts ddClient_contacts;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DDClient ddClient;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private YDClient ydClient;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建人员
|
|
|
+ */
|
|
|
+ @PostMapping("user")
|
|
|
+ McR createUser(HttpServletRequest request) {
|
|
|
+ Map<String, Object> param = UtilServlet.getParamMap(request);
|
|
|
+ log.info("创建用户, {}", param);
|
|
|
+ McException.assertParamException_Null(param, "name", "mobile", "deptId");
|
|
|
+ List<String> deptIds = new ArrayList<>();
|
|
|
+ if (ObjectUtil.isNotNull(param.get("proDeptIds"))) {
|
|
|
+ deptIds.addAll((List<String>) JSON.parse(String.valueOf(param.get("proDeptIds"))));
|
|
|
+ }
|
|
|
+ deptIds.add(String.valueOf(param.get("deptId")));
|
|
|
+ ddClient_contacts.createUser(ddClient.getAccessToken(), String.valueOf(param.get("name")), String.valueOf(param.get("mobile")), deptIds, UtilMap.map("title", param.get("title")));
|
|
|
+ return McR.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建部门
|
|
|
+ */
|
|
|
+ @PostMapping("department")
|
|
|
+ McR createDepartment(HttpServletRequest request) {
|
|
|
+ Map<String, Object> param = UtilServlet.getParamMap(request);
|
|
|
+ log.info("创建部门, {}", param);
|
|
|
+ McException.assertParamException_Null(param, "name", "parentId", "formInstId", "compId_dept");
|
|
|
+ Map extInfo = UtilMap.map("hide_dept, create_dept_group, auto_approve_apply", true, true, true);
|
|
|
+ Map rsp = ddClient_contacts.createDepartment(ddClient.getAccessToken(), String.valueOf(param.get("name")), Long.valueOf(String.valueOf(param.get("parentId"))), extInfo);
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstanceId(String.valueOf(param.get("formInstId")))
|
|
|
+ .updateFormDataJson(JSON.toJSONString(UtilMap.map(String.valueOf(param.get("compId_dept")), rsp.get("dept_id"))))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+ return McR.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("test")
|
|
|
+ McR test() {
|
|
|
+ ydClient.operateData(YDParam.builder()
|
|
|
+ .formInstanceId("FINST-96766PB1LPS9DBVSBKN988PIAFGM3HJBBACGLJO8")
|
|
|
+ .updateFormDataJson(JSON.toJSONString(UtilMap.map("title", "{\"en_US\":\"gao^sheng^hao(高圣昊)发起的UnNamed Process Form\",\"pureEn_US\":\"gao^sheng^hao(高圣昊)发起的UnNamed Process Form\",\"type\":\"i18n\",\"zh_CN\":\"高圣昊发起的付款申请单\"}")))
|
|
|
+ .build(), YDConf.FORM_OPERATION.update);
|
|
|
+ return McR.success();
|
|
|
+ }
|
|
|
+}
|