Compare commits

..

2 Commits

Author SHA1 Message Date
fang febb8f8fa0 Merge remote-tracking branch 'origin/main' into main 2024-11-20 15:22:07 +08:00
fang 65f4076466 保存问题调整 2024-11-20 15:20:05 +08:00
4 changed files with 52 additions and 32 deletions

View File

@ -214,7 +214,7 @@ public class ToDoResendTack extends AbstractTask {
form.append("\"pendingAttr\":"); form.append("\"pendingAttr\":");
form.append("\"0\""); form.append("\"0\"");
form.append("}"); form.append("}");
CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(),title); CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(form.toString(),title,next.getLong("fid").toString(),username);
break; break;
case "2": case "2":
DealToDoHandler.get_DealToDoHandler().sendDealToDo(next.getLong("id"),username); DealToDoHandler.get_DealToDoHandler().sendDealToDo(next.getLong("id"),username);

View File

@ -28,7 +28,7 @@ public class CreateToDoHandler {
} }
return _CreateToDoHandler; return _CreateToDoHandler;
} }
public boolean sendCreateToDo(String messageInfo,String title) { public boolean sendCreateToDo(String messageInfo,String title,String appRecordId,String userId) {
logger.info("###进入待办推送接口数据组装"); logger.info("###进入待办推送接口数据组装");
try { try {
//调用接口结果 //调用接口结果
@ -37,18 +37,18 @@ public class CreateToDoHandler {
//接口调用结果 //接口调用结果
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
if(jsonObject == null){ 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("###响应报文为空"); logger.info("###响应报文为空");
return false; return false;
}else{ }else{
if(Objects.equals("success",jsonObject.getString("status"))){ 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; return true;
}else{ }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("###接口调通失败"); logger.error("###接口调通失败");
return false; return false;

View File

@ -105,7 +105,7 @@ public class BacklogServiceHandle extends AbstractServiceHandler {
//业务自定义数据 //业务自定义数据
backlogMessage.setJsonData("");*/ backlogMessage.setJsonData("");*/
logger.info("###待办拼接请求体:"+form); 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"); logger.info("###结束待办_createToDo");

View File

@ -2,8 +2,11 @@ package shkd.sys.sys.midservice.utils;
import cn.hutool.crypto.SmUtil; import cn.hutool.crypto.SmUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import kd.bos.coderule.api.CodeRuleInfo;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.isc.util.flow.core.Execution;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.coderule.CodeRuleServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.util.StringUtils; import kd.bos.util.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -90,7 +93,7 @@ public class RequestClient {
* @param result 响应报文 * @param result 响应报文
* @param jsonMessage 请求报文 * @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("###开始调用待办保存日志方法"); logger.info("###开始调用待办保存日志方法");
StringBuffer urlStr = new StringBuffer(); StringBuffer urlStr = new StringBuffer();
urlStr.append(this.protocal).append("://").append(this.ip); urlStr.append(this.protocal).append("://").append(this.ip);
@ -99,18 +102,28 @@ public class RequestClient {
} }
urlStr.append(url);; urlStr.append(url);;
logger.info("###保存时,环境参数,protocal:"+this.protocal+",ip:"+this.ip+",this.port:"+this.port); logger.info("###保存时,环境参数,protocal:"+this.protocal+",ip:"+this.ip+",this.port:"+this.port);
DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog"); try{
logger.info("###保存日志表id"+dynamicObject.getPkValue()); DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog1");
dynamicObject.set("shkd_url",urlStr); logger.info("###保存日志表id"+dynamicObject.getPkValue());
dynamicObject.set("shkd_request",title); dynamicObject.set("shkd_url",urlStr);
dynamicObject.set("shkd_request_tag",jsonMessage); CodeRuleInfo codeRule = CodeRuleServiceHelper.getCodeRule(dynamicObject.getDataEntityType().getName(), dynamicObject, null);
dynamicObject.set("shkd_response",isTrue); dynamicObject.set("billno",CodeRuleServiceHelper.getNumber(codeRule,dynamicObject));
dynamicObject.set("shkd_response_tag",result); dynamicObject.set("shkd_traceid",appRecordId);
dynamicObject.set("shkd_status","0"); dynamicObject.set("shkd_username",userId);
dynamicObject.set("billstatus","C"); dynamicObject.set("shkd_request",title);
SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); dynamicObject.set("shkd_request_tag",jsonMessage);
logger.info("###保存日志表后id"+dynamicObject.getPkValue()); dynamicObject.set("shkd_response",isTrue);
logger.info("###结束调用待办保存日志方法"); 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(":").append(this.port);
} }
urlStr.append(url); urlStr.append(url);
DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog1"); try{
dynamicObject.set("shkd_url",urlStr); DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog1");
dynamicObject.set("shkd_traceid",appRecordId); dynamicObject.set("shkd_url",urlStr.toString());
dynamicObject.set("shkd_username",userId); CodeRuleInfo codeRule = CodeRuleServiceHelper.getCodeRule(dynamicObject.getDataEntityType().getName(), dynamicObject, null);
dynamicObject.set("shkd_request","业务id:"+appRecordId+",接收人username"+userId); dynamicObject.set("billno",CodeRuleServiceHelper.getNumber(codeRule,dynamicObject));
dynamicObject.set("shkd_request_tag",jsonMessage); dynamicObject.set("shkd_traceid",appRecordId);
dynamicObject.set("shkd_response",isTrue); dynamicObject.set("shkd_username",userId);
dynamicObject.set("shkd_response_tag",result); dynamicObject.set("shkd_request","业务id:"+appRecordId+",接收人username"+userId);
dynamicObject.set("shkd_status",status); dynamicObject.set("shkd_request_tag",jsonMessage);
dynamicObject.set("billstatus","C"); dynamicObject.set("shkd_response",isTrue);
SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); dynamicObject.set("shkd_response_tag",result);
logger.info("###保存日志表id"+dynamicObject.getPkValue()); dynamicObject.set("shkd_status",status);
logger.info("###结束调用已办、撤销保存日志方法"); 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());
}
} }