其他入库申请单调用FW_获取流程流转数据(OtherInApplyWorkflowDataListPlugin)修改
This commit is contained in:
parent
a0d2825ca8
commit
b1bc25c9e9
|
|
@ -2,12 +2,13 @@ package tqq9.lc123.cloud.app.plugin.form.result;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import kd.bos.bill.BillShowParameter;
|
|
||||||
import kd.bos.context.RequestContext;
|
import kd.bos.context.RequestContext;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||||
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||||
import kd.bos.entity.datamodel.events.PackageDataEvent;
|
import kd.bos.entity.datamodel.events.PackageDataEvent;
|
||||||
import kd.bos.list.events.BeforeShowBillFormEvent;
|
import kd.bos.list.BillList;
|
||||||
import kd.bos.list.plugin.AbstractListPlugin;
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
|
|
@ -17,72 +18,99 @@ import kd.sdk.plugin.Plugin;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils;
|
import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 标准单据列表插件
|
* 标准单据列表插件
|
||||||
* 在列表点击打开的其他入库单时触发调用 FW_获取流程流转数据
|
* 在对其他入库申请单列表进行打开、刷新、更改过滤条件、翻页、修改页面显示条数
|
||||||
*/
|
*/
|
||||||
public class OtherInApplyWorkflowDataListPlugin extends AbstractListPlugin implements Plugin {
|
public class OtherInApplyWorkflowDataListPlugin extends AbstractListPlugin implements Plugin {
|
||||||
// private static String FW_DataFlow_URL;
|
|
||||||
//
|
|
||||||
// static {
|
|
||||||
// DynamicObject url = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
|
|
||||||
// new QFilter[]{new QFilter("number", QCP.equals, "FW_DataFlow_URL")});
|
|
||||||
// FW_DataFlow_URL = url != null ? url.getString("name") : null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void beforeShowBill(BeforeShowBillFormEvent e) {
|
public void afterBindData(EventObject e) {
|
||||||
super.beforeShowBill(e);
|
super.afterBindData(e);
|
||||||
// BillShowParameter parameter = e.getParameter();
|
BillList b = this.getView().getControl("billlistap");
|
||||||
//
|
ListSelectedRowCollection currentListAllRowCollection = b.getCurrentListAllRowCollection();
|
||||||
// DynamicObject tqq9_otherinapply = BusinessDataServiceHelper.loadSingle(parameter.getPkId(), "tqq9_otherinapply");
|
Set<Long> idSet = new HashSet<>();
|
||||||
// String tqq9_fwrequestid = tqq9_otherinapply.getString("tqq9_fwrequestid");
|
for (ListSelectedRow row : currentListAllRowCollection) {
|
||||||
// if (StringUtils.isNotBlank(tqq9_fwrequestid)) {
|
Long primaryKeyValue = (Long) row.getPrimaryKeyValue();
|
||||||
// LCLogService lcLogService = new LCLogServiceImpl();
|
idSet.add(primaryKeyValue);
|
||||||
// HashMap<String, Object> params = new HashMap<>();
|
}
|
||||||
// HashMap<String, String> headers = new HashMap<>();
|
|
||||||
// params.put("requestid", tqq9_fwrequestid);
|
QFilter f = new QFilter("id", "in", idSet);
|
||||||
// Map<String, Object> registMap = FWRestfulUtils.regist();
|
DynamicObject[] billArr = BusinessDataServiceHelper.load("tqq9_otherinapply",
|
||||||
// if (registMap != null && registMap.size() > 0) {
|
"id,billno,tqq9_fwrequestid,tqq9_fwstate,tqq9_auditor,tqq9_auditornode", new QFilter[]{f});
|
||||||
// String spk = StrUtil.nullToEmpty((String) registMap.get("spk"));
|
for (DynamicObject tqq9_otherinapply : billArr) {
|
||||||
// String secrit = StrUtil.nullToEmpty((String) registMap.get("secrit"));
|
String billno = tqq9_otherinapply.getString("billno");
|
||||||
// if (StringUtils.isNotBlank(spk) && StringUtils.isNotBlank(secrit)) {
|
String tqq9_fwrequestid = tqq9_otherinapply.getString("tqq9_fwrequestid");
|
||||||
// String token = FWRestfulUtils.getoken(spk, secrit);
|
String tqq9_fwstate = tqq9_otherinapply.getString("tqq9_fwstate");
|
||||||
// if (StringUtils.isBlank(token)) {
|
if(StringUtils.isNotBlank(tqq9_fwrequestid) && "B".equals(tqq9_fwstate)){
|
||||||
// lcLogService.savelog("FW_获取流程流转数据", FWRestfulUtils.getCurrentTime(), false, false, params.toString(), "获取token失败");
|
String userid = null;
|
||||||
// return;
|
//获取当前用户id
|
||||||
// }
|
Long id = RequestContext.get().getCurrUserId();
|
||||||
// if (StringUtils.isNotBlank(token)) {
|
DynamicObject user = BusinessDataServiceHelper.loadSingle("bos_user",
|
||||||
// headers.put("Authorization", token);
|
new QFilter[]{new QFilter("id", QCP.equals, id)});
|
||||||
// }
|
DynamicObjectCollection entryentity = (DynamicObjectCollection) user.get("entryentity");
|
||||||
// }
|
if (entryentity != null && entryentity.size() > 0) {
|
||||||
// }
|
for (DynamicObject entry : entryentity) {
|
||||||
// Gson gson = new Gson();
|
userid = entry.getString("tqq9_fwuserid");
|
||||||
// try {
|
if (StringUtils.isNotBlank(userid)) {
|
||||||
// String bodyString = HttpRequestUtils.doGet(FW_DataFlow_URL, params, headers);
|
break;
|
||||||
// JSONObject map = gson.fromJson(bodyString, JSONObject.class);
|
}
|
||||||
// String code = map.getString("code");
|
}
|
||||||
// if ("SUCCESS".equals(code)) {
|
if (userid == null) {
|
||||||
// lcLogService.savelog("FW_获取流程流转数据", FW_DataFlow_URL, false, true, params.toString(), bodyString);
|
//获取泛微人员id失败
|
||||||
// } else {
|
return;
|
||||||
// lcLogService.savelog("FW_获取流程流转数据", FW_DataFlow_URL, false, false, params.toString(), "接口调用失败,errMsg:" + bodyString);
|
}
|
||||||
// }
|
}
|
||||||
// } catch (IOException ex) {
|
|
||||||
// lcLogService.savelog("FW_获取流程流转数据", FW_DataFlow_URL, false, false, params.toString(), "接口调用报错,errormessage:" + ex.getMessage());
|
String requestName = "FW_获取流程流转数据";
|
||||||
// throw new RuntimeException(ex);
|
String bodyString = FWRestfulUtils.getFwWorkFlowInfo(requestName, billno, tqq9_fwrequestid, userid);
|
||||||
// }
|
JSONObject map = JSONObject.parseObject(bodyString);
|
||||||
//
|
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_otherinapply.set("tqq9_auditor", fwuserArr[0]);//待审批人
|
||||||
|
tqq9_otherinapply.set("tqq9_auditornode", nodeName);//节点名称
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{tqq9_otherinapply});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void packageData(PackageDataEvent e) {
|
public void packageData(PackageDataEvent e) {
|
||||||
super.packageData(e);
|
super.packageData(e);
|
||||||
// DynamicObject tqq9_otherinapply = BusinessDataServiceHelper.loadSingle(e.getRowData().getPkValue(), "tqq9_otherinapply");
|
// DynamicObject tqq9_otherinapply = BusinessDataServiceHelper.loadSingle(e.getRowData().getPkValue(), "tqq9_otherinapply");
|
||||||
// String billstatus = tqq9_otherinapply.getString("billstatus");
|
// String tqq9_fwstate = tqq9_otherinapply.getString("tqq9_fwstate");
|
||||||
// if ("B".equals(billstatus)) {//已提交
|
// if ("B".equals(tqq9_fwstate)) {//已提交
|
||||||
// String tqq9_fwrequestid = e.getRowData().getString("tqq9_fwrequestid");//"69187"
|
// String tqq9_fwrequestid = e.getRowData().getString("tqq9_fwrequestid");//"69187"
|
||||||
// String billno = e.getRowData().getString("billno");//"QTRKSH251218002"
|
// String billno = e.getRowData().getString("billno");//"QTRKSH251218002" , QTRKSH251218002
|
||||||
// String userid = null;
|
// String userid = null;
|
||||||
// //获取当前用户id
|
// //获取当前用户id
|
||||||
// Long id = RequestContext.get().getCurrUserId();
|
// Long id = RequestContext.get().getCurrUserId();
|
||||||
|
|
@ -112,10 +140,10 @@ public class OtherInApplyWorkflowDataListPlugin extends AbstractListPlugin imple
|
||||||
// if (data != null && data.size() > 0) {
|
// if (data != null && data.size() > 0) {
|
||||||
// for (int i = 0; i < data.size(); i++) {
|
// for (int i = 0; i < data.size(); i++) {
|
||||||
// data0 = (JSONObject) data.get(i);
|
// data0 = (JSONObject) data.get(i);
|
||||||
// Integer isremake = data0.getInteger("isremake");
|
// Integer isremark = data0.getInteger("isremark");
|
||||||
// nodeName = data0.getString("nodeName");
|
// nodeName = data0.getString("nodeName");
|
||||||
// if (StringUtils.isNotBlank(nodeName)) {
|
// if (StringUtils.isNotBlank(nodeName) && isremark != null) {
|
||||||
// if (isremake == 0 && !nodeName.contains("归档")) {
|
// if (isremark == 0 && !nodeName.contains("归档")) {
|
||||||
// fwuserid = String.valueOf(data0.getInteger("userid"));
|
// fwuserid = String.valueOf(data0.getInteger("userid"));
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue