【泛微接口】修改报错

供应商推送分类标准判断
This commit is contained in:
tanfengling@x-ri.com 2025-11-04 16:16:25 +08:00
parent 555dd5aa8e
commit 3d8b26f74e
3 changed files with 22 additions and 30 deletions

View File

@ -7,7 +7,9 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.operate.result.OperationResult; import kd.bos.entity.operate.result.OperationResult;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import tqq9.lc123.cloud.app.plugin.trd.FWImpl; import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
@ -31,24 +33,20 @@ public class SupplierAuditPushFwOp extends AbstractOperationServicePlugIn {
List<Object> successPkIds = operationResult.getSuccessPkIds(); List<Object> successPkIds = operationResult.getSuccessPkIds();
for (Object successPkId : successPkIds) { for (Object successPkId : successPkIds) {
DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle(successPkId, "bd_supplier"); DynamicObject dataEntity = BusinessDataServiceHelper.loadSingle(successPkId, "bd_supplier");
DynamicObjectCollection groupArr = dataEntity.getDynamicObjectCollection("entry_groupstandard"); QFilter f1 = new QFilter("supplier.id", "=", dataEntity.getPkValue());
for (DynamicObject group : groupArr) { QFilter f2 = new QFilter("group.number", "=", "002");
DynamicObject groupid = group.getDynamicObject("groupid"); boolean isPurSupplier = QueryServiceHelper.exists("bd_suppliergroupdetail", new QFilter[]{f1, f2});
if(groupid != null){ if(isPurSupplier){
String groupnumber = groupid.getString("number"); String resultStr = FWImpl.syncSupplier(dataEntity);
if("002".equals(groupnumber)){ if(StringUtils.isNotBlank(resultStr)){
String resultStr = FWImpl.syncSupplier(dataEntity); JSONObject resultJson = JSONObject.parseObject(resultStr);
if(StringUtils.isNotBlank(resultStr)){ String status = resultJson.getString("status");
JSONObject resultJson = JSONObject.parseObject(resultStr); if("1".equals(status)){
String status = resultJson.getString("status"); dataEntity.set("tqq9_ispushfw", true);
if("1".equals(status)){ SaveServiceHelper.save(new DynamicObject[]{dataEntity});
dataEntity.set("tqq9_ispushfw", true);
SaveServiceHelper.save(new DynamicObject[]{dataEntity});
}
}
break;
} }
} }
break;
} }
} }

View File

@ -1,12 +1,15 @@
package tqq9.lc123.cloud.app.plugin.operate.sys; package tqq9.lc123.cloud.app.plugin.operate.sys;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import kd.bd.master.helper.GroupStandardHelper;
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.operate.result.OperationResult; import kd.bos.entity.operate.result.OperationResult;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper; import kd.bos.servicehelper.operation.SaveServiceHelper;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import tqq9.lc123.cloud.app.plugin.trd.FWImpl; import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
@ -26,18 +29,9 @@ public class SupplierSubmitToFwOp extends AbstractOperationServicePlugIn {
List<Object> successPkIds = operationResult.getSuccessPkIds(); List<Object> successPkIds = operationResult.getSuccessPkIds();
for (Object successPkId : successPkIds) { for (Object successPkId : successPkIds) {
DynamicObject bill = BusinessDataServiceHelper.loadSingle(successPkId, "bd_supplier"); DynamicObject bill = BusinessDataServiceHelper.loadSingle(successPkId, "bd_supplier");
DynamicObjectCollection groupstandardColl = bill.getDynamicObjectCollection("entry_groupstandard"); QFilter f1 = new QFilter("supplier.id", "=", bill.getPkValue());
boolean isPurSupplier = false;//是否是采购供应商 QFilter f2 = new QFilter("group.number", "=", "002");
for (DynamicObject groupstandard : groupstandardColl) { boolean isPurSupplier = QueryServiceHelper.exists("bd_suppliergroupdetail", new QFilter[]{f1, f2});
DynamicObject groupid = groupstandard.getDynamicObject("groupid");
if(groupid != null){
String groupNumber = groupid.getString("number");
if("002".equals(groupNumber)){//002-采购供应商
isPurSupplier = true;
break;
}
}
}
if(isPurSupplier){ if(isPurSupplier){
//是采购供应商 才需要推送泛微 //是采购供应商 才需要推送泛微
boolean tqq9_issuccess = bill.getBoolean("tqq9_issuccess"); boolean tqq9_issuccess = bill.getBoolean("tqq9_issuccess");

View File

@ -59,7 +59,7 @@ public class FWImpl {
mainTable.put("bmbm", bmbm); mainTable.put("bmbm", bmbm);
FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); FWRestfulUtils fwRestfulUtils = new FWRestfulUtils();
return fwRestfulUtils.pushBaseData(mainTable, tqq9_fwuserid, number, "bd_warehouse", null); return fwRestfulUtils.pushBaseData(mainTable, tqq9_fwuserid, number, "bd_warehouse");
} }
@ -520,7 +520,7 @@ public class FWImpl {
mainTable.put("ywgz", ywgz); mainTable.put("ywgz", ywgz);
FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); FWRestfulUtils fwRestfulUtils = new FWRestfulUtils();
fwRestfulUtils.pushBaseData(mainTable, cjr, gysbh, "bd_supplier", recordsArr1, recordsArr2); return fwRestfulUtils.pushBaseData(mainTable, cjr, gysbh, "bd_supplier", recordsArr1, recordsArr2);
} }