You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.7 KiB
Java
83 lines
2.7 KiB
Java
package weaver.interfaces.workflow.action.javacode;
|
|
|
|
import com.cloudstore.dev.api.bean.MessageBean;
|
|
import com.cloudstore.dev.api.bean.MessageType;
|
|
import com.cloudstore.dev.api.util.Util_Message;
|
|
import weaver.conn.RecordSet;
|
|
import weaver.interfaces.workflow.action.Action;
|
|
import weaver.general.BaseBean;
|
|
import weaver.soa.workflow.request.RequestInfo;
|
|
|
|
import java.io.IOException;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
/**
|
|
* Online custom action interface
|
|
*/
|
|
public class Action20231113045722 extends BaseBean implements Action {
|
|
/**
|
|
* After selecting aciton after the process path node, this method will be executed after the node is submitted.
|
|
*/
|
|
@Override
|
|
public String execute(RequestInfo request) {
|
|
|
|
|
|
|
|
String requestId = request.getRequestid();
|
|
|
|
|
|
String tablename = request.getRequestManager().getBillTableName();
|
|
|
|
|
|
RecordSet rs = new RecordSet();
|
|
rs.execute("select * from " + tablename + " where requestid = " + requestId);
|
|
rs.next();
|
|
String mainid = rs.getString("id");
|
|
String fsr = rs.getString("fsr");
|
|
//标题
|
|
String title = rs.getString("fsnr");
|
|
//内容
|
|
String context = rs.getString("txxx");
|
|
//PC端链接 纯文本就传空字符串
|
|
String linkUrl = rs.getString("pclj");
|
|
//移动端链接 纯文本就传空字符串
|
|
String linkMobileUrl = rs.getString("applj");
|
|
|
|
//消息来源(见文档第四点补充)
|
|
MessageType messageType = MessageType.newInstance(1542);
|
|
|
|
//接收人id
|
|
Set<String> userIdList = convertToHashSet(fsr);
|
|
|
|
try {
|
|
MessageBean messageBean = Util_Message.createMessage(messageType, userIdList, title, context, linkUrl, linkMobileUrl);
|
|
messageBean.setCreater(1);//创建人id
|
|
//message.setBizState("0");需要修改消息状态时传入,表示消息最初状态为待处理
|
|
// messageBean.setTargetId("121|22"); //消息来源code +“|”+业务id 需要修改消息状态时传入,这个字段是自定义的,和修改消息状态的时候传入相同的值,可做更新。
|
|
Util_Message.store(messageBean);
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return Action.SUCCESS;
|
|
}
|
|
|
|
|
|
public static Set<String> convertToHashSet(String str) {
|
|
Set<String> resultSet = new HashSet<>();
|
|
|
|
if (str != null && !str.isEmpty()) {
|
|
String[] items = str.split(",");
|
|
|
|
for (String item : items) {
|
|
if (item != null && !item.trim().isEmpty()) {
|
|
resultSet.add(item.trim());
|
|
}
|
|
}
|
|
}
|
|
|
|
return resultSet;
|
|
}
|
|
}
|