|
@@ -2,20 +2,26 @@ package com.malk.kabeiyi.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.malk.core.McProject;
|
|
|
import com.malk.kabeiyi.service.KabeiyiService;
|
|
|
+import com.malk.kabeiyi.util.RecognizeAllText;
|
|
|
import com.malk.kabeiyi.util.U8Util;
|
|
|
import com.malk.server.aliwork.YDConf;
|
|
|
import com.malk.server.aliwork.YDParam;
|
|
|
import com.malk.server.common.McR;
|
|
|
import com.malk.server.dingtalk.DDConf;
|
|
|
import com.malk.server.dingtalk.DDR;
|
|
|
+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_Workflow;
|
|
|
+import com.malk.utils.PublicUtil;
|
|
|
import com.malk.utils.UtilHttp;
|
|
|
import com.malk.utils.UtilToken;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.logging.log4j.util.Strings;
|
|
|
import org.slf4j.MDC;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -39,6 +45,9 @@ public class KabeiyiServiceImpl implements KabeiyiService {
|
|
|
@Autowired
|
|
|
private YDService ydService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private YDClient ydClient;
|
|
|
+
|
|
|
@Autowired
|
|
|
private DDConf ddConf;
|
|
|
|
|
@@ -48,6 +57,12 @@ public class KabeiyiServiceImpl implements KabeiyiService {
|
|
|
@Value("${tcdingtalk.appSecret}")
|
|
|
private String appSecret;
|
|
|
|
|
|
+ @Value("${aliwork.accessKeyId}")
|
|
|
+ private String accessKeyId;
|
|
|
+
|
|
|
+ @Value("${aliwork.accessKeySecret}")
|
|
|
+ private String accessKeySecret;
|
|
|
+
|
|
|
//审批实例url前缀(卡倍亿)
|
|
|
private static final String PROC_INST_PREFIX_URL = "https://aflow.dingtalk.com/dingtalk/web/query/pchomepage.htm?from=oflow&op=true&corpid=dingc3a744cb591a7346f2c783f7214b6d69#/plainapproval?procInstId=";
|
|
|
//宜搭-关联数据(卡倍亿)
|
|
@@ -57,6 +72,10 @@ public class KabeiyiServiceImpl implements KabeiyiService {
|
|
|
private static final String PROC_INST_PREFIX_URL2 = "https://aflow.dingtalk.com/dingtalk/web/query/pchomepage.htm?from=oflow&op=true&corpid=ding3ea249a3b5b466d0f2c783f7214b6d69#/plainapproval?procInstId=";
|
|
|
//宜搭-关联数据(特充)
|
|
|
private static final String RELATION2 = "FORM-51E17EFB52C14C9CB9E00168FED2BC18LQ6H";
|
|
|
+ //问题整改表
|
|
|
+ private static final String QUESTION = "FORM-89F515967FF94C62A9031F28EF6000B1YV5Q";
|
|
|
+ //问题整改表流程code
|
|
|
+ private static final String QUESTION_PROC_CODE = "TPROC--DP5660A1LEXNP1S37P7KU9GCHD5U3HB6C360M5";
|
|
|
|
|
|
//关联表单(卡倍亿)
|
|
|
private static final Map<String,String> SCHEMA_MAP = new HashMap<>();
|
|
@@ -284,6 +303,57 @@ public class KabeiyiServiceImpl implements KabeiyiService {
|
|
|
return McR.errorParam("审批实例不存在!");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public McR addQuestionApproval(Map map) {
|
|
|
+ MDC.put("MDC_KEY_PID","1009");
|
|
|
+
|
|
|
+ if (Objects.isNull(map.get("formInstId"))){
|
|
|
+ return McR.errorParam("formInstId不能为空!");
|
|
|
+ }
|
|
|
+ String formInstId = map.get("formInstId").toString();
|
|
|
+
|
|
|
+ DDR_New ddrNew = ydClient.queryData(YDParam.builder()
|
|
|
+ .formInstId(formInstId)
|
|
|
+ .build(), YDConf.FORM_QUERY.retrieve_id);
|
|
|
+ Map formData = ddrNew.getFormData();
|
|
|
+ List<String> reviewerUserIds = (List<String>) formData.get("employeeField_m061zye5_id");
|
|
|
+ List<String> rectificationUserIds = (List<String>) formData.get("employeeField_m061zyeq_id");
|
|
|
+ List<String> deptIds = (List<String>) formData.get("departmentSelectField_m0c3qbjn_id");
|
|
|
+ formData.put("departmentSelectField_m0c3qbjn",deptIds);
|
|
|
+ formData.put("employeeField_m061zye5",rectificationUserIds);
|
|
|
+ formData.put("employeeField_m061zyeq",reviewerUserIds);
|
|
|
+ //发起审批
|
|
|
+ String[] yida = McProject.getYida("1009");
|
|
|
+ Map<String,Object> body = new HashMap<>();
|
|
|
+
|
|
|
+ body.put("appType",yida[0]);
|
|
|
+ body.put("systemToken",yida[1]);
|
|
|
+ body.put("userId",reviewerUserIds.get(0));
|
|
|
+ body.put("formUuid",QUESTION);
|
|
|
+ body.put("processCode",QUESTION_PROC_CODE);
|
|
|
+ body.put("formDataJson", JSONObject.toJSONString(formData));
|
|
|
+
|
|
|
+ UtilHttp.doPost("https://api.dingtalk.com/v1.0/yida/processes/instances/start", ddClient.initTokenHeader(), null, body, DDR_New.class);
|
|
|
+ return McR.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public McR ocr() {
|
|
|
+ try {
|
|
|
+ String content = RecognizeAllText.recognizeText("C:\\Users\\EDY\\Desktop\\3.jpg","Table",accessKeyId,accessKeySecret);
|
|
|
+ return McR.success(content);
|
|
|
+ }catch (Exception e){
|
|
|
+ System.out.println(e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return McR.errorUnknown("识别失败!");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private String getString(Object obj){
|
|
|
+ return obj == null ? "" : obj.toString();
|
|
|
+ }
|
|
|
+
|
|
|
public String getTcAccessToken() {
|
|
|
String accessToken = UtilToken.get("tc-invalid-token-dingtalk");
|
|
|
if (StringUtils.isNotBlank(accessToken)) {
|