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("\"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);

View File

@ -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;

View File

@ -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");

View File

@ -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");
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");
SaveServiceHelper.save(new DynamicObject[]{dynamicObject});
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,8 +143,11 @@ public class RequestClient {
urlStr.append(":").append(this.port);
}
urlStr.append(url);
try{
DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog1");
dynamicObject.set("shkd_url",urlStr);
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);
@ -140,9 +156,13 @@ public class RequestClient {
dynamicObject.set("shkd_response_tag",result);
dynamicObject.set("shkd_status",status);
dynamicObject.set("billstatus","C");
SaveServiceHelper.save(new DynamicObject[]{dynamicObject});
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());
}
}