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

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();
//接收人手机号
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;

View File

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

View File

@ -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) {

View File

@ -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){

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

View File

@ -53,7 +53,6 @@ public class RequestClient {
* @return 响应结果报文
*/
public String callService(String url, String body){
// Map<String, String> 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<String,Object> params=new HashMap<>(2);
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 {
//直接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<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 标题
@ -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("###结束调用已办、撤销保存日志方法");