From 65f4076466c3b8ab56d141b0c23f47f96729cda9 Mon Sep 17 00:00:00 2001 From: fang <123456> Date: Wed, 20 Nov 2024 15:20:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backlogTack/ToDoResendTack.java | 2 +- .../midservice/handler/CreateToDoHandler.java | 8 +-- .../servicehandler/BacklogServiceHandle.java | 2 +- .../sys/midservice/utils/RequestClient.java | 72 ++++++++++++------- 4 files changed, 52 insertions(+), 32 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 716f26c..c104153 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 @@ -214,7 +214,7 @@ public class ToDoResendTack extends AbstractTask { form.append("\"pendingAttr\":"); form.append("\"0\""); form.append("}"); - CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(),title); + CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(),title,next.getLong("fid").toString(),username); break; case "2": DealToDoHandler.get_DealToDoHandler().sendDealToDo(next.getLong("id"),username); 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 1eebc0d..5d001dd 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 @@ -28,7 +28,7 @@ public class CreateToDoHandler { } return _CreateToDoHandler; } - public boolean sendCreateToDo(String messageInfo,String title) { + public boolean sendCreateToDo(String messageInfo,String title,String appRecordId,String userId) { logger.info("###进入待办推送接口数据组装"); try { //调用接口结果 @@ -37,18 +37,18 @@ public class CreateToDoHandler { //接口调用结果 JSONObject jsonObject = JSONObject.parseObject(result); if(jsonObject == null){ - RequestClient.getInstance().saveCreateToDo(title,ToDoCenterConstant.URI_send_addNew,false,result,messageInfo); + RequestClient.getInstance().saveCreateToDo(title,ToDoCenterConstant.URI_send_addNew,false,result,messageInfo,appRecordId,userId); logger.info("###响应报文为空"); return false; }else{ if(Objects.equals("success",jsonObject.getString("status"))){ //发送成功 //调用保存操作 - RequestClient.getInstance().saveCreateToDo(title,ToDoCenterConstant.URI_send_addNew,true,result,messageInfo); + RequestClient.getInstance().saveCreateToDo(title,ToDoCenterConstant.URI_send_addNew,true,result,messageInfo,appRecordId,userId); return true; }else{ //调用保存操作 - RequestClient.getInstance().saveCreateToDo(title,ToDoCenterConstant.URI_send_addNew,false,result,messageInfo); + RequestClient.getInstance().saveCreateToDo(title,ToDoCenterConstant.URI_send_addNew,false,result,messageInfo,appRecordId,userId); //发送失败 logger.error("###接口调通失败"); return false; 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 5703745..fa1d9a5 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 @@ -105,7 +105,7 @@ public class BacklogServiceHandle extends AbstractServiceHandler { //业务自定义数据 backlogMessage.setJsonData("");*/ logger.info("###待办拼接请求体:"+form); - CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(),todoInfo.getTitle()); + CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(),todoInfo.getTitle(),todoInfo.getTaskId().toString(),query_one.getString("username")); } logger.info("###结束待办_createToDo"); 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 91a484d..3f5d645 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 @@ -2,8 +2,11 @@ package shkd.sys.sys.midservice.utils; import cn.hutool.crypto.SmUtil; import cn.hutool.http.HttpRequest; +import kd.bos.coderule.api.CodeRuleInfo; import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.isc.util.flow.core.Execution; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.coderule.CodeRuleServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.util.StringUtils; import org.slf4j.Logger; @@ -90,7 +93,7 @@ public class RequestClient { * @param result 响应报文 * @param jsonMessage 请求报文 */ - public void saveCreateToDo(String title,String url, boolean isTrue,String result,String jsonMessage){ + public void saveCreateToDo(String title,String url, boolean isTrue,String result,String jsonMessage,String appRecordId,String userId){ logger.info("###开始调用待办保存日志方法"); StringBuffer urlStr = new StringBuffer(); urlStr.append(this.protocal).append("://").append(this.ip); @@ -99,18 +102,28 @@ public class RequestClient { } urlStr.append(url);; logger.info("###保存时,环境参数,protocal:"+this.protocal+",ip:"+this.ip+",this.port:"+this.port); - DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog"); - logger.info("###保存日志表id"+dynamicObject.getPkValue()); - dynamicObject.set("shkd_url",urlStr); - dynamicObject.set("shkd_request",title); - dynamicObject.set("shkd_request_tag",jsonMessage); - 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("###结束调用待办保存日志方法"); + try{ + DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog1"); + logger.info("###保存日志表id"+dynamicObject.getPkValue()); + dynamicObject.set("shkd_url",urlStr); + CodeRuleInfo codeRule = CodeRuleServiceHelper.getCodeRule(dynamicObject.getDataEntityType().getName(), dynamicObject, null); + dynamicObject.set("billno",CodeRuleServiceHelper.getNumber(codeRule,dynamicObject)); + dynamicObject.set("shkd_traceid",appRecordId); + dynamicObject.set("shkd_username",userId); + dynamicObject.set("shkd_request",title); + dynamicObject.set("shkd_request_tag",jsonMessage); + dynamicObject.set("shkd_response",isTrue); + dynamicObject.set("shkd_response_tag",result); + dynamicObject.set("shkd_status","0"); + dynamicObject.set("billstatus","C"); + Object[] save = SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); + logger.info("###保存日志表后id"+dynamicObject.getPkValue()); + logger.info("save结果"+save.toString()); + logger.info("###结束调用待办保存日志方法"); + }catch (Exception execution){ + logger.info("###保存日志失败"+execution.getMessage()); + } + } /*** * 保存待办日志 @@ -130,19 +143,26 @@ public class RequestClient { urlStr.append(":").append(this.port); } urlStr.append(url); - DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog1"); - dynamicObject.set("shkd_url",urlStr); - 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("###结束调用已办、撤销保存日志方法"); + try{ + DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog1"); + dynamicObject.set("shkd_url",urlStr.toString()); + CodeRuleInfo codeRule = CodeRuleServiceHelper.getCodeRule(dynamicObject.getDataEntityType().getName(), dynamicObject, null); + dynamicObject.set("billno",CodeRuleServiceHelper.getNumber(codeRule,dynamicObject)); + 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"); + Object[] save = SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); + logger.info("###保存日志表id"+dynamicObject.getPkValue()); + logger.info("save结果"+save.toString()); + logger.info("###结束调用已办、撤销保存日志方法"); + }catch (Exception execution){ + logger.info("###保存日志失败"+execution.getMessage()); + } }