Merge remote-tracking branch 'origin/master'

This commit is contained in:
龚豆豆 2025-12-25 17:41:48 +08:00
commit 4622500cd0
5 changed files with 245 additions and 2 deletions

View File

@ -0,0 +1,34 @@
package tqq9.lc123.cloud.app.plugin.form.im;
import kd.bos.entity.datamodel.ListSelectedRowCollection;
import kd.bos.list.BillList;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.sdk.plugin.Plugin;
import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
import java.util.EventObject;
/**
* 短缺处理单列表插件
* FW获取流程流转数据 接口调用获取下一步处理人节点名称上一步处理人
*/
public class ShortageBillWorkflowDataListPlugin extends AbstractListPlugin implements Plugin {
private static final Log log = LogFactory.getLog(ShortageBillWorkflowDataListPlugin.class);
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
BillList b = this.getView().getControl("billlistap");
ListSelectedRowCollection currentListAllRowCollection = b.getCurrentListAllRowCollection();
String billSign = b.getBillFormId();
String result = FWImpl.getWorkFlowHandler(billSign, currentListAllRowCollection);
if ("调用成功".equals(result)) {
log.info("调用成功");
}else{
getView().showTipNotification("单据【"+result+"】中创建人没有填写泛微人员ID");
log.info("调用失败");
}
}
}

View File

@ -0,0 +1,34 @@
package tqq9.lc123.cloud.app.plugin.form.pm;
import kd.bos.entity.datamodel.ListSelectedRowCollection;
import kd.bos.list.BillList;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.sdk.plugin.Plugin;
import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
import java.util.EventObject;
/**
* 采购订单采购变更单列表插件
* FW获取流程流转数据 接口调用获取下一步处理人节点名称上一步处理人
*/
public class PurOrderBillWorkflowDataListPlugin extends AbstractListPlugin implements Plugin {
private static final Log log = LogFactory.getLog(PurOrderBillWorkflowDataListPlugin.class);
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
BillList billList = this.getView().getControl("billlistap");
ListSelectedRowCollection currentListAllRowCollection = billList.getCurrentListAllRowCollection();
String billSign = billList.getBillFormId();
String result = FWImpl.getWorkFlowHandler(billSign, currentListAllRowCollection);
if ("调用成功".equals(result)) {
log.info("调用成功");
}else{
getView().showTipNotification("单据【"+result+"】中创建人没有填写泛微人员ID");
log.info("调用失败");
}
}
}

View File

@ -0,0 +1,34 @@
package tqq9.lc123.cloud.app.plugin.form.result;
import kd.bos.entity.datamodel.ListSelectedRowCollection;
import kd.bos.list.BillList;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.sdk.plugin.Plugin;
import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
import java.util.EventObject;
/**
*采购退货申请单列表插件
*FW获取流程流转数据 接口调用获取下一步处理人节点名称上一步处理人
*/
public class PmPurRefundApplyBillWorkflowDataListPlugin extends AbstractListPlugin implements Plugin {
private static final Log log = LogFactory.getLog(PmPurRefundApplyBillWorkflowDataListPlugin.class);
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
BillList billList = this.getView().getControl("billlistap");
ListSelectedRowCollection currentListAllRowCollection = billList.getCurrentListAllRowCollection();
String billSign = billList.getBillFormId();
String result = FWImpl.getWorkFlowHandler(billSign, currentListAllRowCollection);
if ("调用成功".equals(result)) {
log.info("调用成功");
}else{
getView().showTipNotification("单据【"+result+"】中创建人没有填写泛微人员ID");
log.info("调用失败");
}
}
}

View File

@ -0,0 +1,143 @@
package tqq9.lc123.cloud.app.plugin.form.sys;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.ListSelectedRow;
import kd.bos.entity.datamodel.ListSelectedRowCollection;
import kd.bos.list.BillList;
import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.sdk.plugin.Plugin;
import org.apache.commons.lang3.StringUtils;
import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
import tqq9.lc123.cloud.app.plugin.utils.ConfigUtils;
import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils;
import tqq9.lc123.cloud.app.plugin.utils.FWUtils;
import java.util.EventObject;
import java.util.HashSet;
import java.util.Set;
/**
*供应商供应商变更列表插件
*FW获取流程流转数据 接口调用获取下一步处理人节点名称上一步处理人
*/
public class SupplierBillWorkflowDataListPlugin extends AbstractListPlugin implements Plugin {
private static final Log log = LogFactory.getLog(SupplierBillWorkflowDataListPlugin.class);
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
BillList billList = this.getView().getControl("billlistap");
ListSelectedRowCollection currentListAllRowCollection = billList.getCurrentListAllRowCollection();
String billSign = billList.getBillFormId();
Set<Long> idSet = new HashSet<>();
for (ListSelectedRow row : currentListAllRowCollection) {
Long primaryKeyValue = (Long) row.getPrimaryKeyValue();
idSet.add(primaryKeyValue);
}
QFilter f = new QFilter("id", "in", idSet);
DynamicObject[] billArr = BusinessDataServiceHelper.load(billSign,
"id,number,tqq9_fwrequestid,tqq9_fwstate,tqq9_auditor,tqq9_auditornode,tqq9_sybclr", new QFilter[]{f});
for (DynamicObject supplier : billArr) {
supplier = BusinessDataServiceHelper.loadSingle(supplier.getPkValue(), supplier.getDynamicObjectType().getName());
String userid = null;
String requestid = null;
//获取当前用户id对应的泛微用户ID
// Long id = RequestContext.get().getCurrUserId();
// Long id = tqq9_otheroutapply.getLong("id");
//获取创建人id对应的泛微用户ID
DynamicObject creator = supplier.getDynamicObject("creator");
Long id = creator.getLong("id");
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");
}
String number = supplier.getString("number");
log.info("number:" + number);
String tqq9_fwupdid = supplier.getString("tqq9_fwrequestid");//泛微修改流程id
String tqq9_fwrequestid = supplier.getString("tqq9_fwrequestid");//泛微流程id
if (StringUtils.isNotBlank(tqq9_fwupdid)){
requestid = tqq9_fwupdid;
} else if (StringUtils.isNotBlank(tqq9_fwrequestid)){
requestid = tqq9_fwrequestid;
}
String tqq9_fwstate = supplier.getString("tqq9_fwstate");
if (StringUtils.isNotBlank(requestid) && "B".equals(tqq9_fwstate)) {
if (StringUtils.isBlank(userid)) {
//获取第三方配置表的泛微用户ID
userid = ConfigUtils.getThirdConfigByNumber("FW_WorkFlowInfo_UserId");
if (StringUtils.isBlank(userid)) {
log.info("没有获取到泛微用户ID当前用户ID:" + id);
continue;
}
}
String requestName = "FW_获取流程流转数据";
//调用泛微接口获取下一步处理人
String bodyString = FWRestfulUtils.getRequest(requestName, number, requestid, userid);
log.info("number:" + number + ",bodyString:" + bodyString);
JSONObject map = JSONObject.parseObject(bodyString);
if (map != null) {
JSONArray data = map.getJSONArray("data");//节点id
if (data != null && data.size() > 0) {
String xybNodeName = null;//下一步节点名称
String xybclrid = null;//下一步处理人OAuserid
String sybclrid = null;//上一步处理人OAuserid
boolean existXybCLR = false;//是否找到了下一步处理人
boolean existSybCLR = false;//是否找到了上一步处理人
for (int i = 0; i < data.size(); i++) {
JSONObject data0 = (JSONObject) data.get(i);
Integer isremark = data0.getInteger("isremark");
String nodeName = data0.getString("nodeName");
if (StringUtils.isNotBlank(nodeName) && isremark != null) {
if (isremark == 0 && !nodeName.contains("归档")) {
xybclrid = String.valueOf(data0.getInteger("userid"));
xybNodeName = nodeName;
existXybCLR = true;
}else if (isremark == 2 && !nodeName.contains("申请人") && !nodeName.contains("发起")) {
sybclrid = String.valueOf(data0.getInteger("userid"));
existSybCLR = true;
}
if(existXybCLR && existSybCLR){
//如果下一步处理人和上一步处理人都找到了可以直接跳过了
break;
}
}
}
//给下一步处理人下一步节点赋值
boolean isUpdate = false;//是否需要更新数据
if (StringUtils.isNotBlank(xybclrid)) {
DynamicObject kdUser = FWUtils.getKdUserByFwUserID(xybclrid);
if (kdUser != null) {
supplier.set("tqq9_auditor", kdUser);//下一步处理人待审批人
supplier.set("tqq9_auditornode", xybNodeName);//节点名称
isUpdate = true;
}
}
//给上一步处理人赋值用于执行撤回操作
if (StringUtils.isNotBlank(sybclrid)) {
DynamicObject kdUser = FWUtils.getKdUserByFwUserID(sybclrid);
if (kdUser != null) {
supplier.set("tqq9_sybclr", kdUser);//上一步处理人
isUpdate = true;
}
}
if(isUpdate){
SaveServiceHelper.save(new DynamicObject[]{supplier});
}
}
}
}
}
}
}

View File

@ -6584,11 +6584,9 @@ public class FWImpl {
String requestName = "新增物料流程";
String wfID = ConfigUtils.getThirdConfigByNumber("FW_WFID_XZWL");
String requestid = bill.getString("tqq9_fwrequestid");
// boolean tqq9_issuccess = bill.getBoolean("tqq9_issuccess");
if (lcbh.endsWith("_copy")) {
requestName = "变更物料流程";
wfID = ConfigUtils.getThirdConfigByNumber("FW_WFID_WLBG");
requestid = bill.getString("tqq9_fwupdid");
JSONObject m_bgyy = new JSONObject();
m_bgyy.put("fieldName", "bgyy");