单据审批界面
This commit is contained in:
parent
42383585e7
commit
81caa915a9
|
@ -14,8 +14,10 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.logging.Log;
|
import kd.bos.logging.Log;
|
||||||
import kd.bos.logging.LogFactory;
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||||
import kd.bos.workflow.engine.msg.AbstractMessageServiceHandler;
|
import kd.bos.workflow.engine.msg.AbstractMessageServiceHandler;
|
||||||
import kd.bos.workflow.engine.msg.ctx.MessageContext;
|
import kd.bos.workflow.engine.msg.ctx.MessageContext;
|
||||||
import kd.bos.workflow.engine.msg.info.MessageInfo;
|
import kd.bos.workflow.engine.msg.info.MessageInfo;
|
||||||
|
@ -152,6 +154,28 @@ public class MessageListen extends AbstractMessageServiceHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void sendMessage(HashMap<String,Object> map) {
|
||||||
|
log.info("消息通知~~~~~~~~~~");
|
||||||
|
List<Map<String, Object>> requestBodyList = getRequestBodyList3(map);
|
||||||
|
log.info("推送消息通知内容:{}", requestBodyList);
|
||||||
|
|
||||||
|
|
||||||
|
Map resultMap;
|
||||||
|
for (Iterator var6 = requestBodyList.iterator(); var6.hasNext(); resultMap.get("code")) {
|
||||||
|
Map<String, Object> requestBody = (Map) var6.next();
|
||||||
|
String jsonStr = this.pushZHData(requestBody);
|
||||||
|
log.info("传阅结果 jsonStr:" + jsonStr);
|
||||||
|
resultMap = (Map) JSON.parseObject(jsonStr, Map.class);
|
||||||
|
resultMap.get("errcode");
|
||||||
|
if ("0".equals(resultMap.get("errcode"))) {
|
||||||
|
log.info("推送已办任务内容成功");
|
||||||
|
} else {
|
||||||
|
log.info("推送已办任务内容失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void deleteToDo(MessageContext messageContext, ToDoInfo toDoInfo) {
|
public void deleteToDo(MessageContext messageContext, ToDoInfo toDoInfo) {
|
||||||
log.info("删除待办~~~~~~~~~~");
|
log.info("删除待办~~~~~~~~~~");
|
||||||
|
@ -490,7 +514,6 @@ public class MessageListen extends AbstractMessageServiceHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Map<String, Object>> requestBodyList = new ArrayList();
|
List<Map<String, Object>> requestBodyList = new ArrayList();
|
||||||
Iterator var21 = userNames.iterator();
|
|
||||||
String syscodestr = System.getProperty("cxkg.integration.MessageListen.oakey");
|
String syscodestr = System.getProperty("cxkg.integration.MessageListen.oakey");
|
||||||
JSONObject jsonCode = JSON.parseObject(syscodestr);
|
JSONObject jsonCode = JSON.parseObject(syscodestr);
|
||||||
String syscode = jsonCode.getString(entityName);
|
String syscode = jsonCode.getString(entityName);
|
||||||
|
@ -504,7 +527,7 @@ public class MessageListen extends AbstractMessageServiceHandler {
|
||||||
if(entityName != null && entityName.startsWith("差旅报销单")){
|
if(entityName != null && entityName.startsWith("差旅报销单")){
|
||||||
entityName = "差旅报销单";
|
entityName = "差旅报销单";
|
||||||
}
|
}
|
||||||
|
Iterator var21 = userNames.iterator();
|
||||||
int i = 1;
|
int i = 1;
|
||||||
while (var21.hasNext()) {
|
while (var21.hasNext()) {
|
||||||
String username = (String) var21.next();
|
String username = (String) var21.next();
|
||||||
|
@ -579,6 +602,72 @@ public class MessageListen extends AbstractMessageServiceHandler {
|
||||||
return requestBodyList;
|
return requestBodyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<Map<String, Object>> getRequestBodyList3(HashMap<String,Object> map) {
|
||||||
|
String createDateString = "";
|
||||||
|
String entityName = "";
|
||||||
|
String startUserName = "";
|
||||||
|
Long startUserId = null;
|
||||||
|
String taskName = "";
|
||||||
|
Long userId = UserServiceHelper.getCurrentUserId();
|
||||||
|
DynamicObject bos_user = BusinessDataServiceHelper.loadSingle(userId, "bos_user");
|
||||||
|
String username = bos_user.getString("username");
|
||||||
|
Long processInstanceId = Long.valueOf((String) map.get("processInstanceId")) ;//processInstanceId
|
||||||
|
QFilter proQF = new QFilter("processinstanceid", QCP.equals, processInstanceId);
|
||||||
|
DynamicObject processInstance = BusinessDataServiceHelper.loadSingle("wf_hitaskinst",proQF.toArray());
|
||||||
|
if (processInstance != null) {
|
||||||
|
entityName = processInstance.getString("entityname");
|
||||||
|
startUserId = processInstance.getLong("senderid");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startUserId != null) {
|
||||||
|
DynamicObject startUser = BusinessDataServiceHelper.loadSingle(startUserId, "bos_user");
|
||||||
|
if (startUser != null) {
|
||||||
|
startUserName = startUser.getString("username");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Date createDate = new Date();
|
||||||
|
if (createDate != null) {
|
||||||
|
createDateString = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(createDate);
|
||||||
|
}
|
||||||
|
List<Map<String, Object>> requestBodyList = new ArrayList();
|
||||||
|
Map<String,Object> requestBody = new HashMap();
|
||||||
|
|
||||||
|
String syscodestr = System.getProperty("cxkg.integration.MessageListen.oakey");
|
||||||
|
JSONObject jsonCode = JSON.parseObject(syscodestr);
|
||||||
|
String syscode = jsonCode.getString(entityName);
|
||||||
|
if(syscode == null || "".equals(syscode)){
|
||||||
|
log.info("cxkg.integration.MessageListen.syscode is null: " +
|
||||||
|
entityName );
|
||||||
|
}
|
||||||
|
|
||||||
|
if(entityName != null && entityName.startsWith("差旅报销单")){
|
||||||
|
entityName = "差旅报销单";
|
||||||
|
}
|
||||||
|
String title = (String) map.get("title");//标题
|
||||||
|
String url = (String) map.get("url");//processInstanceId
|
||||||
|
|
||||||
|
|
||||||
|
requestBody.put("syscode", syscode);
|
||||||
|
requestBody.put("flowid", String.valueOf(processInstanceId));
|
||||||
|
requestBody.put("requestname", title);
|
||||||
|
requestBody.put("workflowname", entityName); // + "审批流程"
|
||||||
|
requestBody.put("nodename", taskName);
|
||||||
|
requestBody.put("pcurl", url + "&closeType=closeWin");
|
||||||
|
requestBody.put("appurl", url != null ? getAppurl(url) : null);
|
||||||
|
requestBody.put("isremark", "2");
|
||||||
|
requestBody.put("viewtype", "1");
|
||||||
|
requestBody.put("creator", startUserName);
|
||||||
|
requestBody.put("createdatetime", createDateString);
|
||||||
|
requestBody.put("receiver", username);
|
||||||
|
requestBody.put("receivedatetime", createDateString);
|
||||||
|
requestBody.put("receivets", String.valueOf((new Date()).getTime()));
|
||||||
|
requestBody.put("userid", username);
|
||||||
|
requestBody.put("bizState", "0");
|
||||||
|
requestBody.put("lastNameList", username);
|
||||||
|
requestBodyList.add(requestBody);
|
||||||
|
return requestBodyList;
|
||||||
|
}
|
||||||
|
|
||||||
// private String pushZHData(Map<String, Object> params) {
|
// private String pushZHData(Map<String, Object> params) {
|
||||||
// log.info("推送消息到中环.....");
|
// log.info("推送消息到中环.....");
|
||||||
// Map<String, Object> registAppid = TokenAuthentication.registAppid();
|
// Map<String, Object> registAppid = TokenAuthentication.registAppid();
|
||||||
|
|
|
@ -1,18 +1,27 @@
|
||||||
package shkd.plugin;
|
package shkd.plugin;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.workflow.design.plugin.AbstractWorkflowPlugin;
|
||||||
|
import kd.bos.workflow.engine.msg.MessageService;
|
||||||
|
import kd.bos.workflow.engine.msg.cmd.MessageScheduleHelper;
|
||||||
import kd.bos.workflow.taskcenter.plugin.ApprovalBillPlugin;
|
import kd.bos.workflow.taskcenter.plugin.ApprovalBillPlugin;
|
||||||
import kd.bos.workflow.taskcenter.plugin.ApprovalBillViewPlugin;
|
import kd.bos.workflow.taskcenter.plugin.ApprovalBillViewPlugin;
|
||||||
|
import kd.imc.bdm.common.constant.BotpCallBackLogConstant;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import kd.bos.workflow.engine.msg.info.MessageInfo;
|
||||||
import org.agrona.Strings;
|
import org.agrona.Strings;
|
||||||
|
import shkd.cosmic.cxkg.integration.MessageListen;
|
||||||
|
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审批单据界面插件
|
* 审批单据界面插件
|
||||||
*/
|
*/
|
||||||
public class ApprovalBillFormPlugin extends kd.bos.workflow.taskcenter.plugin.ApprovalBillViewPlugin {
|
public class ApprovalBillFormPlugin extends AbstractWorkflowPlugin {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,8 +30,19 @@ public class ApprovalBillFormPlugin extends kd.bos.workflow.taskcenter.plugin.Ap
|
||||||
Map<String, Object> customParams = this.getView().getFormShowParameter().getCustomParams();
|
Map<String, Object> customParams = this.getView().getFormShowParameter().getCustomParams();
|
||||||
String apptype = (String) customParams.get("apptype");//获取应用类型
|
String apptype = (String) customParams.get("apptype");//获取应用类型
|
||||||
String msgId = (String) customParams.get("msgId");
|
String msgId = (String) customParams.get("msgId");
|
||||||
if ("waver".equals(apptype) && Strings.isEmpty(msgId)){//当接口对象为泛微且提供消息对象主键不为空
|
Object processInstanceId = customParams.get("processInstanceId");
|
||||||
this.getView().showTipNotification("ce"+msgId);
|
if ("waver".equals(apptype) && !Strings.isEmpty(msgId) && processInstanceId != null){//当接口对象为泛微且提供消息对象主键不为空
|
||||||
|
DynamicObject wf_msg_message = BusinessDataServiceHelper.loadSingle(msgId, "wf_msg_message");//获取消息模型对象
|
||||||
|
HashMap<String,Object> map = new HashMap<>();
|
||||||
|
if (wf_msg_message != null){
|
||||||
|
map.put("processInstanceId",processInstanceId);
|
||||||
|
String title = wf_msg_message.getString("title");//标题
|
||||||
|
map.put("title",title);
|
||||||
|
String contenturl = wf_msg_message.getString("contenturl");//url
|
||||||
|
map.put("url",contenturl);
|
||||||
|
}
|
||||||
|
MessageListen messageListen = new MessageListen();
|
||||||
|
messageListen.sendMessage(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue