待办日志表从日志表单换成普通单据,补发逻辑调整

This commit is contained in:
fang 2024-11-19 13:41:32 +08:00
parent 396c497fa8
commit 2f8b4b1ec4
6 changed files with 44 additions and 84 deletions

View File

@ -171,26 +171,12 @@ public class ToDoResendTack extends AbstractTask {
Row next = iterator.next(); Row next = iterator.next();
//接收人手机号 //接收人手机号
DynamicObject dynamicObject = QueryServiceHelper.queryOne("bos_user", "name,shkd_pid," + DynamicObject dynamicObject = QueryServiceHelper.queryOne("bos_user", "name,shkd_pid," +
"phone", new QFilter[]{new QFilter("id", "=", next.getString("freceiveuserid"))}); "phone,username", new QFilter[]{new QFilter("id", "=", next.getString("freceiveuserid"))});
String phone = dynamicObject.getString("phone"); String username = dynamicObject.getString("phone");
switch (t_status) { switch (t_status) {
case "1": 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"); String title = "请处理" + next.getString("fstartname") + "提交的" + next.getString("fentityname");
backlogMessage.setTitle(title);
//PC地址 //PC地址
String pcUrl = GetUrlUtils.getInstance().getPcUrl(next.getString("fprocessingpage"), String pcUrl = GetUrlUtils.getInstance().getPcUrl(next.getString("fprocessingpage"),
next.getString("fprocessingmobilepage"), next.getString("fprocessingmobilepage"),
@ -199,34 +185,42 @@ public class ToDoResendTack extends AbstractTask {
next.getString("factivityId"), next.getString("factivityId"),
next.getString("fbusinesskey"), next.getString("fbusinesskey"),
next.getString("fid")); next.getString("fid"));
backlogMessage.setHandleUrl(pcUrl); StringBuffer form = new StringBuffer();
//PC地址查看 form.append("{");
backlogMessage.setViewUrl(pcUrl + "&ado=view"); form.append("\"title\":");
//app地址 form.append("\""+title+"\",");
backlogMessage.setAppHandleUrl(pcUrl); form.append("\"bName\":");
//App应用名称 form.append("\""+next.getString("fentityname")+"\",");
backlogMessage.setAppName(""); form.append("\"bussinessCode\":");
//app地址查看 form.append("\""+next.getString("fbillno")+"\",");
backlogMessage.setAppViewUrl(pcUrl + "&ado=view"); form.append("\"urGency\":");
//业务id form.append("\"0\",");
backlogMessage.setPendingId(String.valueOf(next.getLong("fid"))); form.append("\"currentStepName\":");
// 业务编码 form.append("\""+next.getString("FNAME")+"\",");
backlogMessage.setBussinessCode(next.getString("fbillno")); form.append("\"sendUserName\":");
//属性 form.append("\""+next.getString("startname")+"\",");
backlogMessage.setPendingAttr("0"); form.append("\"receiveUsersysName\":");
//notifyMsg 通知消息 form.append("\""+username+"\",");
backlogMessage.setNotifyMsg(""); form.append("\"receiveUserId\":");
//notifyMethod 通知方式 form.append("\""+username+"\",");
backlogMessage.setNotifyMethod(""); form.append("\"handleUrl\":");
//业务自定义数据 form.append("\""+pcUrl+"\",");
backlogMessage.setJsonData(""); form.append("\"appHandleUrl\":");
CreateToDoHandler.get_CreateToDoHandler().sendCreateToDo(String.valueOf(backlogMessage),title); 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; break;
case "2": case "2":
DealToDoHandler.get_DealToDoHandler().sendDealToDo(next.getLong("id"),phone); DealToDoHandler.get_DealToDoHandler().sendDealToDo(next.getLong("id"),username);
break; break;
case "5": case "5":
deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDo(next.getLong("id"),phone); deleteToDoHandler.get_deleteToDoHandler().sendDeleteToDo(next.getLong("id"),username);
break; break;
default: default:
break; break;

View File

@ -31,10 +31,6 @@ public class CreateToDoHandler {
public boolean sendCreateToDo(String messageInfo,String title) { public boolean sendCreateToDo(String messageInfo,String title) {
logger.info("###进入待办推送接口数据组装"); logger.info("###进入待办推送接口数据组装");
try { try {
//body
/* JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("params",messageInfo);
String jsonMessage = jsonObject2.toJSONString();*/
//调用接口结果 //调用接口结果
String result = RequestClient.getInstance().callService(ToDoCenterConstant.URI_send_addNew,messageInfo); String result = RequestClient.getInstance().callService(ToDoCenterConstant.URI_send_addNew,messageInfo);
logger.info("###接口返回结果"+result); logger.info("###接口返回结果"+result);

View File

@ -28,18 +28,10 @@ public class DealToDoHandler {
public boolean sendDealToDo(Long appRecordId, String userId) { public boolean sendDealToDo(Long appRecordId, String userId) {
try { try {
//body String part = "{ \"appRecordId\": \""+appRecordId+"\", \"userId\": \""+userId+"\" }";
// 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 result = RequestClient.getInstance().callService(ToDoCenterConstant.URI_SEND_finish, part); String result = RequestClient.getInstance().callService(ToDoCenterConstant.URI_SEND_finish, part);
//保存发送消息日志 //保存发送消息日志
// writeMessageLog(MessageCenterConstant.URI_SEND_MESSAGE,messageInfo,result);
//接口调用结果 //接口调用结果
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
if (jsonObject == null) { if (jsonObject == null) {

View File

@ -29,14 +29,10 @@ public class deleteToDoHandler {
public boolean sendDeleteToDo(Long appRecordId,String userId) { public boolean sendDeleteToDo(Long appRecordId,String userId) {
try { try {
//body //body
// JSONObject jsonObject2 = new JSONObject(); String part = "{ \"appRecordId\": \""+appRecordId+"\", \"userId\": \""+userId+"\" }";
String part = " {\"appRecordId\": "+appRecordId+",\"userId\": "+userId+"}";
// jsonObject2.put("params",part);
// String jsonMessage = jsonObject2.toJSONString();
//调用接口结果 //调用接口结果
String result = RequestClient.getInstance().callService(ToDoCenterConstant.URI_send_deleteP,part); String result = RequestClient.getInstance().callService(ToDoCenterConstant.URI_send_deleteP,part);
//保存发送消息日志 //保存发送消息日志
// writeMessageLog(MessageCenterConstant.URI_SEND_MESSAGE,messageInfo,result);
//接口调用结果 //接口调用结果
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
if(jsonObject== null){ if(jsonObject== null){

View File

@ -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.CreateToDoHandler;
import shkd.sys.sys.midservice.handler.DealToDoHandler; import shkd.sys.sys.midservice.handler.DealToDoHandler;
import shkd.sys.sys.midservice.handler.deleteToDoHandler; import shkd.sys.sys.midservice.handler.deleteToDoHandler;
import shkd.sys.sys.midservice.model.BacklogMessage;
import java.util.List; import java.util.List;

View File

@ -53,7 +53,6 @@ public class RequestClient {
* @return 响应结果报文 * @return 响应结果报文
*/ */
public String callService(String url, String body){ public String callService(String url, String body){
// Map<String, String> headers = getHeaders();
StringBuffer urlStr = new StringBuffer(); StringBuffer urlStr = new StringBuffer();
urlStr.append(this.protocal).append("://").append(this.ip); urlStr.append(this.protocal).append("://").append(this.ip);
if (!StringUtils.isEmpty(this.port)) { if (!StringUtils.isEmpty(this.port)) {
@ -68,12 +67,6 @@ public class RequestClient {
logger.info("###请求头主要参数:authen(sign)"+authenticationCode+"###时间戳"+timestamp); logger.info("###请求头主要参数:authen(sign)"+authenticationCode+"###时间戳"+timestamp);
Map<String,Object> params=new HashMap<>(2); Map<String,Object> params=new HashMap<>(2);
params.put("params",body); params.put("params",body);
/* Map<String,Object> 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 { try {
//直接POST请求 //直接POST请求
responseText = HttpRequest.post(urlStr.toString()) responseText = HttpRequest.post(urlStr.toString())
@ -83,26 +76,12 @@ public class RequestClient {
.header("origin_client", "HttpToken") .header("origin_client", "HttpToken")
.form(params) .form(params)
.execute().body(); .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) { } 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; return responseText;
} }
/* private Map<String, String> getHeaders(){
logger.info("###进入拼接请求头方法");
Map<String,String> 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 标题 * @param title 标题
@ -128,6 +107,7 @@ public class RequestClient {
dynamicObject.set("shkd_response",isTrue); dynamicObject.set("shkd_response",isTrue);
dynamicObject.set("shkd_response_tag",result); dynamicObject.set("shkd_response_tag",result);
dynamicObject.set("shkd_status","0"); dynamicObject.set("shkd_status","0");
dynamicObject.set("billstatus","C");
SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); SaveServiceHelper.save(new DynamicObject[]{dynamicObject});
logger.info("###保存日志表后id"+dynamicObject.getPkValue()); logger.info("###保存日志表后id"+dynamicObject.getPkValue());
logger.info("###结束调用待办保存日志方法"); logger.info("###结束调用待办保存日志方法");
@ -150,13 +130,16 @@ public class RequestClient {
urlStr.append(":").append(this.port); urlStr.append(":").append(this.port);
} }
urlStr.append(url); urlStr.append(url);
DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog"); DynamicObject dynamicObject = BusinessDataServiceHelper.newDynamicObject("shkd_backlog1");
dynamicObject.set("shkd_url",urlStr); 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_request_tag",jsonMessage);
dynamicObject.set("shkd_response",isTrue); dynamicObject.set("shkd_response",isTrue);
dynamicObject.set("shkd_response_tag",result); dynamicObject.set("shkd_response_tag",result);
dynamicObject.set("shkd_status",status); dynamicObject.set("shkd_status",status);
dynamicObject.set("billstatus","C");
SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); SaveServiceHelper.save(new DynamicObject[]{dynamicObject});
logger.info("###保存日志表id"+dynamicObject.getPkValue()); logger.info("###保存日志表id"+dynamicObject.getPkValue());
logger.info("###结束调用已办、撤销保存日志方法"); logger.info("###结束调用已办、撤销保存日志方法");