FWImpl中添加公共方法(WorkflowData)
This commit is contained in:
parent
94dd54a7bc
commit
7a71daf5e2
|
|
@ -5,13 +5,21 @@ import cn.hutool.http.HttpResponse;
|
|||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.AttachmentServiceHelper;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import tqq9.lc123.cloud.app.plugin.form.result.OtherInApplyWorkflowDataListPlugin;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.ConfigUtils;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.FWUtils;
|
||||
|
|
@ -7404,4 +7412,80 @@ public class FWImpl {
|
|||
//如果单据上纯在泛微流程id,重新提交调用泛微提交接口,如果没有泛微流程id,就调用新增接口
|
||||
return fwRestfulUtils.doBillAction(mainArr, detailRootArr, "集中采购审批单流程", fw_wfid_xzcgdd, lcbh, tqq9_fwrequestid, sqr);
|
||||
}
|
||||
|
||||
|
||||
private static final Log log = LogFactory.getLog(FWImpl.class);
|
||||
/*调用泛微接口:获取流程流转数据
|
||||
billSign :单据标识
|
||||
currentListAllRowCollection :当前节点所有行数据
|
||||
*/
|
||||
public static Boolean WorkflowData(String billSign, ListSelectedRowCollection currentListAllRowCollection){
|
||||
Set<Long> idSet = new HashSet<>();
|
||||
for (ListSelectedRow row : currentListAllRowCollection) {
|
||||
Long primaryKeyValue = (Long) row.getPrimaryKeyValue();
|
||||
idSet.add(primaryKeyValue);
|
||||
}
|
||||
//获取第三方配置表的泛微用户ID
|
||||
String userid = ConfigUtils.getThirdConfigByNumber("FW_WorkFlowInfo_UserId");
|
||||
|
||||
QFilter f = new QFilter("id", "in", idSet);
|
||||
DynamicObject[] billArr = BusinessDataServiceHelper.load(billSign,
|
||||
"id,billno,tqq9_fwrequestid,tqq9_fwstate,tqq9_auditor,tqq9_auditornode", new QFilter[]{f});
|
||||
for (DynamicObject tqq9_otheroutapply : billArr) {
|
||||
String billno = tqq9_otheroutapply.getString("billno");
|
||||
log.info("billno:" + billno);
|
||||
String tqq9_fwrequestid = tqq9_otheroutapply.getString("tqq9_fwrequestid");
|
||||
String tqq9_fwstate = tqq9_otheroutapply.getString("tqq9_fwstate");
|
||||
if (StringUtils.isNotBlank(tqq9_fwrequestid) && "B".equals(tqq9_fwstate)) {
|
||||
if (StringUtils.isBlank(userid)) {
|
||||
//获取当前用户id对应的泛微用户ID
|
||||
Long id = RequestContext.get().getCurrUserId();
|
||||
QFilter f1 = new QFilter("id", "=", id);
|
||||
QFilter f2 = new QFilter("entryentity.ispartjob", "=", false);
|
||||
DynamicObject bos_user = QueryServiceHelper.queryOne("bos_user", "id,entryentity.tqq9_fwuserid", new QFilter[]{f1, f2});
|
||||
if (bos_user != null) {
|
||||
userid = bos_user.getString("entryentity.tqq9_fwuserid");
|
||||
}
|
||||
if (StringUtils.isBlank(userid)) {
|
||||
log.info("没有获取到泛微用户ID,当前用户ID:" + id);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String requestName = "FW_获取流程流转数据";
|
||||
//调用泛微接口获取下一步处理人
|
||||
String bodyString = FWRestfulUtils.getRequest(requestName, billno, tqq9_fwrequestid, userid);
|
||||
log.info("billno:" + billno + ",bodyString:" + bodyString);
|
||||
JSONObject map = JSONObject.parseObject(bodyString);
|
||||
if (map != null) {
|
||||
JSONArray data = map.getJSONArray("data");//节点id
|
||||
if (data != null && data.size() > 0) {
|
||||
String nodeName = null;
|
||||
String fwuserid = null;
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject data0 = (JSONObject) data.get(i);
|
||||
Integer isremark = data0.getInteger("isremark");
|
||||
nodeName = data0.getString("nodeName");
|
||||
if (StringUtils.isNotBlank(nodeName) && isremark != null) {
|
||||
if (isremark == 0 && !nodeName.contains("归档")) {
|
||||
fwuserid = String.valueOf(data0.getInteger("userid"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(fwuserid)) {
|
||||
DynamicObject[] fwuserArr = BusinessDataServiceHelper.load("bos_user", "id,name,number",
|
||||
new QFilter[]{new QFilter("entryentity.tqq9_fwuserid", QCP.equals, fwuserid)});
|
||||
if (fwuserArr != null && fwuserArr.length > 0) {
|
||||
tqq9_otheroutapply.set("tqq9_auditor", fwuserArr[0]);//待审批人
|
||||
tqq9_otheroutapply.set("tqq9_auditornode", nodeName);//节点名称
|
||||
SaveServiceHelper.save(new DynamicObject[]{tqq9_otheroutapply});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue