From 2f8b4b1ec4bcc308fb244985d28f1ed71b6f1b0d Mon Sep 17 00:00:00 2001 From: fang <123456> Date: Tue, 19 Nov 2024 13:41:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=85=E5=8A=9E=E6=97=A5=E5=BF=97=E8=A1=A8?= =?UTF-8?q?=E4=BB=8E=E6=97=A5=E5=BF=97=E8=A1=A8=E5=8D=95=E6=8D=A2=E6=88=90?= =?UTF-8?q?=E6=99=AE=E9=80=9A=E5=8D=95=E6=8D=AE,=E8=A1=A5=E5=8F=91?= =?UTF-8?q?=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backlogTack/ToDoResendTack.java | 74 +++++++++---------- .../midservice/handler/CreateToDoHandler.java | 4 - .../midservice/handler/DealToDoHandler.java | 10 +-- .../midservice/handler/deleteToDoHandler.java | 6 +- .../servicehandler/BacklogServiceHandle.java | 1 - .../sys/midservice/utils/RequestClient.java | 33 ++------- 6 files changed, 44 insertions(+), 84 deletions(-) diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/backlogTack/ToDoResendTack.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/backlogTack/ToDoResendTack.java index 6286f69..716f26c 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/backlogTack/ToDoResendTack.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/backlogTack/ToDoResendTack.java @@ -171,26 +171,12 @@ public class ToDoResendTack extends AbstractTask { Row next = iterator.next(); //接收人手机号 DynamicObject dynamicObject = QueryServiceHelper.queryOne("bos_user", "name,shkd_pid," + - "phone", new QFilter[]{new QFilter("id", "=", next.getString("freceiveuserid"))}); - String phone = dynamicObject.getString("phone"); + "phone,username", new QFilter[]{new QFilter("id", "=", next.getString("freceiveuserid"))}); + String username = dynamicObject.getString("phone"); switch (t_status) { case "1": - BacklogMessage backlogMessage = new BacklogMessage(); - //业务类型名称 - backlogMessage.setbName("业务类型名称"); - // 紧急程度 - backlogMessage.setUrGency("0"); - //当前节点名称 - backlogMessage.setCurrentStepName(next.getString("FNAME")); - //上步骤名称 - backlogMessage.setPreStepName(""); - // startname发起人名称 - backlogMessage.setSendUserName(dynamicObject.getString("startname")); - //接收人手机号 - backlogMessage.setReceiveUserId(phone); //标题 String title = "请处理" + next.getString("fstartname") + "提交的" + next.getString("fentityname"); - backlogMessage.setTitle(title); //PC地址 String pcUrl = GetUrlUtils.getInstance().getPcUrl(next.getString("fprocessingpage"), next.getString("fprocessingmobilepage"), @@ -199,34 +185,42 @@ public class ToDoResendTack extends AbstractTask { next.getString("factivityId"), next.getString("fbusinesskey"), next.getString("fid")); - backlogMessage.setHandleUrl(pcUrl); - //PC地址查看 - backlogMessage.setViewUrl(pcUrl + "&ado=view"); - //app地址 - backlogMessage.setAppHandleUrl(pcUrl); - //App应用名称 - backlogMessage.setAppName(""); - //app地址查看 - backlogMessage.setAppViewUrl(pcUrl + "&ado=view"); - //业务id - backlogMessage.setPendingId(String.valueOf(next.getLong("fid"))); - // 业务编码 - backlogMessage.setBussinessCode(next.getString("fbillno")); - //属性 - backlogMessage.setPendingAttr("0"); - //notifyMsg 通知消息 - backlogMessage.setNotifyMsg(""); - //notifyMethod 通知方式 - backlogMessage.setNotifyMethod(""); - //业务自定义数据 - backlogMessage.setJsonData(""); - CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(String.valueOf(backlogMessage),title); + StringBuffer form = new StringBuffer(); + form.append("{"); + form.append("\"title\":"); + form.append("\""+title+"\","); + form.append("\"bName\":"); + form.append("\""+next.getString("fentityname")+"\","); + form.append("\"bussinessCode\":"); + form.append("\""+next.getString("fbillno")+"\","); + form.append("\"urGency\":"); + form.append("\"0\","); + form.append("\"currentStepName\":"); + form.append("\""+next.getString("FNAME")+"\","); + form.append("\"sendUserName\":"); + form.append("\""+next.getString("startname")+"\","); + form.append("\"receiveUsersysName\":"); + form.append("\""+username+"\","); + form.append("\"receiveUserId\":"); + form.append("\""+username+"\","); + form.append("\"handleUrl\":"); + form.append("\""+pcUrl+"\","); + form.append("\"appHandleUrl\":"); + form.append("\""+pcUrl+"\","); + form.append("\"appName\":"); + form.append("\""+next.getString("fentityname")+"\","); + form.append("\"pendingId\":"); + form.append("\""+next.getLong("fid")+"\","); + form.append("\"pendingAttr\":"); + form.append("\"0\""); + form.append("}"); + CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(),title); break; case "2": - DealToDoHandler.get_DealToDoHandler().sendDealToDo(next.getLong("id"),phone); + DealToDoHandler.get_DealToDoHandler().sendDealToDo(next.getLong("id"),username); break; case "5": - deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDo(next.getLong("id"),phone); + deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDo(next.getLong("id"),username); break; default: break; diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/CreateToDoHandler.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/CreateToDoHandler.java index de79ead..1eebc0d 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/CreateToDoHandler.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/CreateToDoHandler.java @@ -31,10 +31,6 @@ public class CreateToDoHandler { public boolean sendCreateToDo(String messageInfo,String title) { logger.info("###进入待办推送接口数据组装"); try { - //body - /* JSONObject jsonObject2 = new JSONObject(); - jsonObject2.put("params",messageInfo); - String jsonMessage = jsonObject2.toJSONString();*/ //调用接口结果 String result = RequestClient.getInstance().callService(ToDoCenterConstant.URI_send_addNew,messageInfo); logger.info("###接口返回结果"+result); diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/DealToDoHandler.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/DealToDoHandler.java index f75f979..2db7285 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/DealToDoHandler.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/DealToDoHandler.java @@ -28,18 +28,10 @@ public class DealToDoHandler { public boolean sendDealToDo(Long appRecordId, String userId) { try { - //body - // JSONObject jsonObject2 = new JSONObject(); - /* JSONObject jsonObject_1 = new JSONObject(); - jsonObject_1.put("appRecordId", appRecordId); - jsonObject_1.put("userId",userId);*/ - String part = " {\"appRecordId\": " + appRecordId + ",\"userId\": " + userId + "}"; - /* jsonObject2.put("params",part); - String jsonMessage = jsonObject2.toJSONString();*/ + String part = "{ \"appRecordId\": \""+appRecordId+"\", \"userId\": \""+userId+"\" }"; //调用接口结果 String result = RequestClient.getInstance().callService(ToDoCenterConstant.URI_SEND_finish, part); //保存发送消息日志 - // writeMessageLog(MessageCenterConstant.URI_SEND_MESSAGE,messageInfo,result); //接口调用结果 JSONObject jsonObject = JSONObject.parseObject(result); if (jsonObject == null) { diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/deleteToDoHandler.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/deleteToDoHandler.java index 92faab6..abb3130 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/deleteToDoHandler.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/handler/deleteToDoHandler.java @@ -29,14 +29,10 @@ public class deleteToDoHandler { public boolean sendDeleteToDo(Long appRecordId,String userId) { try { //body -// JSONObject jsonObject2 = new JSONObject(); - String part = " {\"appRecordId\": "+appRecordId+",\"userId\": "+userId+"}"; -// jsonObject2.put("params",part); -// String jsonMessage = jsonObject2.toJSONString(); + String part = "{ \"appRecordId\": \""+appRecordId+"\", \"userId\": \""+userId+"\" }"; //调用接口结果 String result = RequestClient.getInstance().callService(ToDoCenterConstant.URI_send_deleteP,part); //保存发送消息日志 - // writeMessageLog(MessageCenterConstant.URI_SEND_MESSAGE,messageInfo,result); //接口调用结果 JSONObject jsonObject = JSONObject.parseObject(result); if(jsonObject== null){ diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java index 85ad673..5703745 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/servicehandler/BacklogServiceHandle.java @@ -12,7 +12,6 @@ import kd.bos.workflow.engine.msg.info.ToDoInfo; import shkd.sys.sys.midservice.handler.CreateToDoHandler; import shkd.sys.sys.midservice.handler.DealToDoHandler; import shkd.sys.sys.midservice.handler.deleteToDoHandler; -import shkd.sys.sys.midservice.model.BacklogMessage; import java.util.List; diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/utils/RequestClient.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/utils/RequestClient.java index e2a223d..91a484d 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/utils/RequestClient.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/midservice/utils/RequestClient.java @@ -53,7 +53,6 @@ public class RequestClient { * @return 响应结果报文 */ public String callService(String url, String body){ - // Map headers = getHeaders(); StringBuffer urlStr = new StringBuffer(); urlStr.append(this.protocal).append("://").append(this.ip); if (!StringUtils.isEmpty(this.port)) { @@ -68,12 +67,6 @@ public class RequestClient { logger.info("###请求头主要参数:authen(sign)"+authenticationCode+"###时间戳"+timestamp); Map params=new HashMap<>(2); params.put("params",body); - /* Map params=new HashMap<>(2); - params.put("params",body); - String timestamp = Long.toString(System.currentTimeMillis() / 1000); - byte[] securityKey = clientSecret.substring(10, 26).getBytes(); - String authenticationCode = SmUtil.sm4(securityKey).encryptHex(clientKey + clientSecret + timestamp); - */ try { //直接POST请求 responseText = HttpRequest.post(urlStr.toString()) @@ -83,26 +76,12 @@ public class RequestClient { .header("origin_client", "HttpToken") .form(params) .execute().body(); - logger.info(String.format("###调用接口成功,请求URL:%s,请求Body:%s,响应报文:%s", urlStr, body, responseText)); + logger.info(String.format("###调用接口成功,请求URL:%s,请求Body:%s,响应报文:%s", urlStr, params, responseText)); } catch (Exception e) { - logger.error(String.format("###调用接口异常:%s,请求URL:%s,请求Body:%s", e.getMessage(), urlStr, body), e); + logger.error(String.format("###调用接口异常:%s,请求URL:%s,请求Body:%s", e.getMessage(), urlStr, params), e); } return responseText; } - - /* private Map getHeaders(){ - logger.info("###进入拼接请求头方法"); - Map header=new HashMap<>(); - String timestamp = Long.toString(System.currentTimeMillis() / 1000); - byte[] securityKey = this.clientSecret.substring(10, 26).getBytes(); - String authenticationCode = SmUtil.sm4(securityKey).encryptHex(clientKey + clientSecret + timestamp); - header.put("authen", authenticationCode); - header.put("clientKey", clientKey); - header.put("timestamp", timestamp); - header.put("origin_client", "HttpToken"); - logger.info("###authen(sign)"+authenticationCode+"###时间戳"+timestamp); - return header; - }*/ /*** * 保存待办日志 * @param title 标题 @@ -128,6 +107,7 @@ public class RequestClient { dynamicObject.set("shkd_response",isTrue); dynamicObject.set("shkd_response_tag",result); dynamicObject.set("shkd_status","0"); + dynamicObject.set("billstatus","C"); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); logger.info("###保存日志表后id"+dynamicObject.getPkValue()); logger.info("###结束调用待办保存日志方法"); @@ -150,13 +130,16 @@ public class RequestClient { urlStr.append(":").append(this.port); } urlStr.append(url); - DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog"); + DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog1"); dynamicObject.set("shkd_url",urlStr); - dynamicObject.set("shkd_request","业务id:"+appRecordId+",接收人手机号:"+userId); + dynamicObject.set("shkd_traceid",appRecordId); + dynamicObject.set("shkd_username",userId); + dynamicObject.set("shkd_request","业务id:"+appRecordId+",接收人username:"+userId); dynamicObject.set("shkd_request_tag",jsonMessage); dynamicObject.set("shkd_response",isTrue); dynamicObject.set("shkd_response_tag",result); dynamicObject.set("shkd_status",status); + dynamicObject.set("billstatus","C"); SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); logger.info("###保存日志表id"+dynamicObject.getPkValue()); logger.info("###结束调用已办、撤销保存日志方法");