diff --git a/shkd-cosmic-debug/src/main/java/shkd/cosmic/cxkg/integration/MessageListen.java b/shkd-cosmic-debug/src/main/java/shkd/cosmic/cxkg/integration/MessageListen.java index 150a318..532e2d5 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/cosmic/cxkg/integration/MessageListen.java +++ b/shkd-cosmic-debug/src/main/java/shkd/cosmic/cxkg/integration/MessageListen.java @@ -10,6 +10,7 @@ import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.util.*; +import com.alibaba.fastjson.JSONObject; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; @@ -25,6 +26,8 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; +import javax.json.JsonObject; + public class MessageListen extends AbstractMessageServiceHandler { private static final Log log = LogFactory.getLog(MessageListen.class); static Map processInstanceStateMap = new HashMap(); @@ -116,7 +119,7 @@ public class MessageListen extends AbstractMessageServiceHandler { for (Iterator> var6 = requestBodyList.iterator(); var6.hasNext(); resultMap.get("code")) { Map requestBody = var6.next(); String jsonStr = pushZHData(requestBody); - log.info("已办任务结果~"+jsonStr); + log.info("已办任务结果~" + jsonStr); resultMap = (Map) JSON.parseObject(jsonStr, Map.class); resultMap.get("code"); if ("200".equals(resultMap.get("code"))) { @@ -184,6 +187,7 @@ public class MessageListen extends AbstractMessageServiceHandler { Long startUserId = messageContext.getStartUserId(); String startUserMobile = ""; String startUserName = ""; + String startUserTrueName = ""; Long executionId = messageContext.getExecutionId(); String executionName = ""; Long taskId = messageContext.getTaskId(); @@ -202,12 +206,14 @@ public class MessageListen extends AbstractMessageServiceHandler { String billno = ""; String title = isdel ? "流程撤回" : toDoInfo.getContent(); String entityName = messageContext.getEntityName(); - if (title != null) { - int dex = title.indexOf("单", 0); - if (dex != -1) { - title = title.substring(dex);//截取单后面的字符串 - } - } +// if (title != null) { +// int dex = title.indexOf("单", 0); +// if (dex != -1) { +// title = title.substring(dex);//截取单后面的字符串 +// } +// } + + // if (title == null) { // title = "任务:" + taskId + "已办"; // } @@ -228,6 +234,7 @@ public class MessageListen extends AbstractMessageServiceHandler { if (startUser != null) { startUserMobile = startUser.getString("phone"); startUserName = startUser.getString("username"); + startUserTrueName = startUser.getString("name"); } @@ -316,17 +323,20 @@ public class MessageListen extends AbstractMessageServiceHandler { userNames.add(startUserName); List> requestBodyList = new ArrayList(); Iterator var47 = userNames.iterator(); + String syscode = System.getProperty("cxkg.integration.MessageListen.oakey"); + JSONObject jsonCode = JSON.parseObject(syscode); + title = "请处理" + startUserTrueName + "提交的" + entityName + ":" + messageContext.getBillNo(); while (var47.hasNext()) { String userName = (String) var47.next(); if (userName.equals(startUserName)) { Map requestBody = new HashMap(); - requestBody.put("syscode", "JD"); + requestBody.put("syscode", jsonCode.getString(entityName)); requestBody.put("flowid", String.valueOf(processInstanceId)); - requestBody.put("requestname", "主题:"+title); - requestBody.put("workflowname", entityName + "审批流程"); + requestBody.put("requestname", title); + requestBody.put("workflowname", entityName); // + "审批流程" requestBody.put("nodename", taskName); - requestBody.put("pcurl", url+"&closeType=closeWin"); + requestBody.put("pcurl", url + "&closeType=closeWin"); requestBody.put("appurl", url != null ? getAppurl(url) : null); requestBody.put("isremark", String.valueOf(tasktype)); requestBody.put("viewtype", "1"); @@ -342,15 +352,15 @@ public class MessageListen extends AbstractMessageServiceHandler { // requestBodyList.add(requestBody); } else { Map requestBody = new HashMap(); - requestBody.put("syscode", "JD"); + requestBody.put("syscode", jsonCode.getString(entityName)); requestBody.put("flowid", String.valueOf(processInstanceId)); - if(title!=null){ + if (title != null) { requestBody.put("requestname", title); - }else{ + } else { requestBody.put("requestname", entityName); } - requestBody.put("workflowname", entityName + "审批流程"); + requestBody.put("workflowname", entityName);// + "审批流程" requestBody.put("nodename", taskName); requestBody.put("pcurl", url); requestBody.put("appurl", getAppurl(url)); @@ -642,7 +652,8 @@ public class MessageListen extends AbstractMessageServiceHandler { // String kd21_largetextfield = kd21_oa_matters.getString("kd21_largetextfield"); // String apiUrl = kd21_largetextfield; // "/api/hrm/resful/getHrmUserInfoWithPage" - String apiUrl = "http://" + "10.157.226.9:8088" + "/rest/ofs/ReceiveRequestInfoByJson"; + // "http://" + "10.157.226.9:8088" + String apiUrl = System.getProperty("cxkg.integration.MessageListen.apiUrl") + "/rest/ofs/ReceiveRequestInfoByJson"; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); @@ -695,7 +706,7 @@ public class MessageListen extends AbstractMessageServiceHandler { conn.setRequestProperty("accept", "*/*"); conn.setRequestProperty("connection", "Keep-Alive"); conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)"); - if (data != null){ + if (data != null) { for (Map.Entry entry : data.entrySet()) { conn.setRequestProperty(entry.getKey(), entry.getValue()); } @@ -761,7 +772,7 @@ public class MessageListen extends AbstractMessageServiceHandler { // DynamicObject kd21_oa_matters = BusinessDataServiceHelper.loadSingle("kd21_oa_matters", "id,name,kd21_largetextfield", new QFilter[]{filter}); // String kd21_largetextfield = kd21_oa_matters.getString("kd21_largetextfield"); // String apiUrl = kd21_largetextfield; - String apiUrl = "http://" + "10.157.226.9:8088" + "/rest/ofs/deleteUserRequestInfoByJson"; + String apiUrl = System.getProperty("cxkg.integration.MessageListen.apiUrl") + "/rest/ofs/deleteUserRequestInfoByJson"; RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON);